2

I am a beginner, just started studying around NLP, specifically various language models. So far, my understanding is that - the goal is to understand/produce natural language.

So far the methods I have studied speak about correlation of words, using correct combination to make a meaningful sentence. I also have the sense that the language modeling does not really care about the punctuation marks (or did I miss it?)

Thus I am curious is there a way they can classify sentence types such as Declarative, Imperative, Interrogative or Exclamatory?

DukeZhou
  • 6,237
  • 5
  • 25
  • 53

2 Answers2

1

You can generally identify the mood of a verb by looking at grammatical structures; you don't need any language model for it. The three major moods in English are declarative, interrogative, and imperative. Assuming English is the language you will be working with, here are some questions:

  • Does he like coffee?
  • Is this a piece of chocolate?
  • When did you go there?
  • How is that possible?
  • Have you got any cheese?

Apart from the obvious marker '?', these examples all start with either an auxiliary verb or a wh-word, so are fairly easy to recognise with a simple lookup. The one exception I can think of is an imperative (Do be quiet, please), where the do is followed by a further verb, which wouldn't be the case with a question.

Imperatives:

  • Go to school now!
  • Eat up your vegetables!
  • Do shut up.
  • Have a go at it!

These start with a main verb in the base form, or with an auxiliary followed by a verb/not a pronoun.

Once you identified all interrogative and imperative sentences, all the remaining ones should be declarative.

So, all you would need is a small list of auxiliary verb, pronouns, and wh-words, and with a bit of simple string matching you should get most of the way there. Undoubtedly there will be some exceptions, but there shouldn't be too many of them.

In other languages there will be similar structures; or there might be explicit markers (eg in Hawai'ian an imperative starts with the marker 'e', as in Hele 'oe ma ka hale "you go to the house" vs E hele 'oe ma ka hale "Go to the house!")

Oliver Mason
  • 5,322
  • 12
  • 32
0

If you can classify words then you can easily classify sentences. One of interesting problems you can solve then is »what are allowed sentence forms?« How can you classify words? By searching for features that are common between them. These features are all possible truths that are true for a word, like with what other words it appears in same sentence, what is their spatial relation, what is frequency of appearance.

Tone Škoda
  • 219
  • 1
  • 5