Skip to content
Advertisement

Position of that Noun and Verb

I have a rule-based code that prints out the Noun which is followed by a verb in a sentence

JavaScript

The output of a sentence following this rule:

high school football players charged after video surfaces showing hazing

JavaScript

trump accuser pushes new york to pass the adult survivors act plans to sue

JavaScript

Is there a way to also print out the position of that Noun that was printed due to the rule? for example :

JavaScript

Advertisement

Answer

I changed the script and separated the state machine segment. The most serious problem with this program IMO is it’s just returning the first pattern (you can fix it quickly).

JavaScript

output:

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement