I'm a bit new to NLP/IE. I'm looking for the task within NLP/IE that would be concerned with extracting a value that has been assigned.

For instance, given the text "The value is 45.1hz" or "The color is blue", I would like to be able to extract the fact that 45.1hz has been assigned to the value, or that the color has been set as blue.

I have tried to find the right name for this task - It seems somewhat related to relation extraction, however it doesn't seem to have two or more entities, and the relation unclear to me.

It may also be related to triplet extraction, but once again I'm a bit loss on what the values would be, i.e. (color, be, blue) ?

I'm looking for the name for this type of task, where you extract the value of an assignment, for a specific pre-defined value.


It's indeed a very specific type of relation extraction. Generally relation extraction is much more complex because it's not only about simple sentences Subject Verb Object and not only with the verb is.

It's not clear to me if your examples are representative of the real cases you're dealing with: if yes, you probably don't need full blown relation extraction, basic pattern matching rules will do the trick.

  • $\begingroup$ Thanks for the answer.I found an example of such a relation extraction in link, i.e. where "Obama is president" is extracted as (Obama; is; president). $\endgroup$
    – James2000
    Sep 29 '19 at 16:22

With the Free Wolfram Engine for Developers you may use Wolfram Language. If you are using Python then use the Wolfram Client Library for Python to access the engine in Python.

You may use FindTextualAnswer.

FindTextualAnswer["The value is 45.1 hz.", "What is the value?", 
 TargetDevice -> "GPU"]
"45.1 hz"
FindTextualAnswer["45.1 hz was selected as nearest to the true value.", "What is the value?", 
 TargetDevice -> "GPU"]
"45.1 hz"
FindTextualAnswer["The color is blue.", "What is the color?", 
 TargetDevice -> "GPU"]
FindTextualAnswer["We think that the color is closest to teal.", "What is the color?", 
 TargetDevice -> "GPU"]

There would need to be a selection of the subject. Looking at TextStructure the Noun Phrase is a good place to start.

TextStructure["The color is blue."]

Mathematica graphics

TextCases could be used to extract this with "NounPhrase".

TextCases["The color is blue.", "NounPhrase", 
 TargetDevice -> "GPU"]
{"The color"}

or "Noun"

TextCases["The color is blue.", "Noun", 
 TargetDevice -> "GPU"]

Combining with the other functions.

str = "The color is blue.";
    StringTemplate["What is the `1`?"]@#,
    TargetDevice -> "GPU"
} & /@ TextCases[str, "Noun", TargetDevice -> "GPU"]
{{"color", "blue"}}

Hope this helps.

  • $\begingroup$ Thanks for the answer, it was helpful. In case anyone is interested, FindTextualAnswer seems to be a fully fledged QA network using BiLSTMs, Attention and other neural networks along with softmax and beam search to find the most probable start and end tokens of the answer in the text. Full details and code are here [link] (blog.wolfram.com/2018/02/15/…). $\endgroup$
    – James2000
    Sep 29 '19 at 16:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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