ACE for text classification
patelrajnath opened this issue · 3 comments
patelrajnath commented
Hi there,
How complex it would be to use ACE for text classification. If possible, could you please add a working example for the same.
Regards
Raj
wangxinyu0922 commented
Hi,
I have no experience for implementing text classificiation models. If you want to implement the code by yourself, I have following suggestions:
- text_classification_model.py is the code for implementing text classification model from flair.
- At line 82-84, the code extracts document embeddings instead of word embeddings for the model. Therefore, you may need to decide which part of embedding represents the text embedding. For example, the representation of
[CLS]
is used by BERT for text classification. Some of the embeddings like Flair embeddings is difficult to decide text embeddings. It could be easier using the pooled/mean embeddings over tokens. You can find the implementation at embeddings.py. But personally I suggest you just implement the function at the forward function at text_classification_model.py. - In general, I suggest you may follow the embedding selection function at sequence_tagger_model.py to implement ACE attext_classification_model.py. Then just calculate pooled/mean embeddings over the selected embedding candidates as the text representation for the
sentence_tensor
.
Best.
patelrajnath commented
nguyenbh commented
Close this issue since Xinyu's comment seems to resolve the OP question.