# How can I classify specific types of words in a document given I have the full text of the document and the labels

I am working on a project that involves picking out specific kinds of objects from text. The documents I am going though are life sciences and biomedical in nature, and in these documents there are specific biomedical "objects" I want to pick out. The nature and variety of the text objects means I can't use regex or string matching. It has to be some kind of classification.

These text objects can be one word, or multiple words, but they are always in sequence. An example sentence would be like

During the process of protein synthesis, X was used.


I need to pick out X. Luckily, I have plenty of labeled documents, and plenty of labels to go along with it. So I know a human can pick out these objects. So the challenge now is to get a machine to be able to pick out these types of objects from unseen text. I am working under the assumption that these specific text objects all fall under somewhat similar grammatical and textual context, so given enough labeled data, a machine should be able to learn how to pick out the text object.

Two Main Questions.

1. How do I label specific words in a document such that some model will understand that given a sequence of text, the object at position Y is a labeled and what we should be trying to classify.

2. Does anything I just said make any sense? Is there any research on what I've been talking about, because I've looked around and have not been able to find much.

## 1 Answer

The task you describe corresponds exactly to Named Entity Recognition (NER). This is a standard task for which there are many available libraries. NER is usually done with sequence labelling models such as Conditional Random Fields. Sequence labelling implies that the data is provided as a sequence which looks like this:

During    <features ...>  O
the                       O
process                   O
of                        O
protein                   O
synthesis                 O
,                         O
X_token1                  B_classX
X_token2                  I_classX
X_token3                  I_classX
was                       O
used                      O
.                         O


Here I'm using the common BIO format (Begin, Inside, Outside an entity) but there are variants. The model is trained with data annotated in this way, where there can be additional features (very often POS tag and others). Then when fresh text is provided (with the features) the model predicts the BIO tag for every token.

There has been a lot of research and resources produced for extracting specific entities in the specific context of biomedical data, so you might be interested in exploring these specific resources as well.

• Medline, PMC are huge collections of biomedical abstracts/papers
• There are many tools for extracting biomedical annotations based on Medline/PMC data: PubTator, cTakes, SciSpacy,etc.