3
$\begingroup$

I have this problem scenario - Given a set of tokens, string them or a subset of the tokens together using stop words into a sequence. I am clear that I can have potentially infinite pre-training data for this problem. For example, given the set of tokens {cat, jump, mouse} - possible outputs might be: a. the cat jumped on a mouse, b. the cat and the mouse jumped, c. cats jump and so on...

I am not sure if this is a well-studied problem scenario or what directions/model architectures should I explore. TIA.

$\endgroup$
4
  • $\begingroup$ Can you please clarify the user-story here - is it "classifying a sentence given a set of tokens"? $\endgroup$
    – mork
    Apr 3, 2022 at 9:26
  • $\begingroup$ @mork, added an example $\endgroup$ Apr 4, 2022 at 0:52
  • $\begingroup$ And you're trying to piece together just the grammatically correct ones? Or just asking how to piece all possible permutations? $\endgroup$
    – mork
    Apr 4, 2022 at 8:51
  • $\begingroup$ @mork, just the gramatically correct ones $\endgroup$ Apr 6, 2022 at 3:41

1 Answer 1

0
$\begingroup$

The great NodeBox Linguistics project and its follower pattern seems unsupported now, but if you could make them run - you can try the following, based on the RDF-Triple of: subject predicate object.

It won't cover every permutation, and won't be 100% grammatically correct - but it's a good start.

from pattern import en

for subject in subjects:
  for object in objects:
    for v in verbs:
      predicate = en.verb.past(v)
      print(f'The {subject} {predicate} the {object}')

The subjects and objects lists can be imported from any nlp nouns list. Same for the verbs list.

You can go on and add present and future tenses, each with an appropriate "sentence template".

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.