xxxxxxxxxx
30
// A2Z F24
// Daniel Shiffman
// https://github.com/Programming-from-A-to-Z/A2Z-F24
let input, button, greeting;
let txt;
function setup() {
noCanvas();
// Make an h2 element
greeting = createElement('h2', 'Type a sentence.');
// Make a text input field
input = createInput('The quick brown fox jumped over the lazy dog.');
input.size(400);
// Make a submit button
button = createButton('submit');
// Here a button triggers the "hello message"
button.mousePressed(process);
}
function process() {
let sentence = input.value();
// POS tags come in an array
// https://rednoise.org/rita/reference/RiTa/pos/index.html
let pos = RiTa.pos(sentence);
createP(`Parts of speech: + ${pos.join(' ')}`);
}