1

I'm trying to use Machine Learning to label sentences (each sentence with a single label, I assume sentences are independent from each other). I thought linear CRF model would be ok for this case, but I have some questions.

I tried using CRF++ (other implementations I saw seem to have analogical formats). It uses sentences as input, but the output label is assigned to each token. How to use a single label for the whole sentence? (The hack I thought of would be to assign a significant label only to dot in the test data and treat it as the output label for the whole sentence.)

How can sentences of different length be used? The training configuration requires to specify which tokens are taken into consideration when analysing the current token. But a sentence can have a large or small number of tokens and I want to use all tokens from a sentence (not more or less), to utilise the whole information.

From this question it seems that what I'm trying to do is possible (a single label for the whole sequence), but I don't know how to format training data for that.

Community
  • 1
  • 1
nuoritoveri
  • 2,494
  • 1
  • 24
  • 28
  • Split the sentence into tokens, put it in one line rather than separate, add corresponding features and then the label. Maybe it can find certain patterns. – arjun May 24 '17 at 20:49

2 Answers2

0

I think you are using the wrong tool for the job. To classify the entire sentence you could try using something like Facebook's fasttext.

https://github.com/facebookresearch/fastText

Ashemah
  • 410
  • 4
  • 11
0

As Ashemah said, maybe you are using the wrong tool. CRFs are typically used if you want to label sequences, e.g. a sequence of words or even a sequence of sentences. But, as you assume that your sentences are independent of each other, you might want to look at each of them independently. Therefore, your task is not sequence labeling but a simple classification. For that you can use several other models such as SVM, Naive Bayes, kNN, and many more.

ada91
  • 828
  • 2
  • 7
  • 19