I'm stuck with a problem related to NLP and I was hoping I could get some advice to help solve it. I am currently writing a program in which given a sentence that contains a monetary number, the program will be able to return the noun phrase that corresponds to that number. For example, given this sentence:
"That bike costs $100."
I am matching the noun phrase "bike" to "$100". I am using Stanford NLP's parser to find the noun phrases in a sentence, and as you know it is possible to have noun phrases within noun phrases. For example, in the sentence:
"The purchase price for these goods was $50."
The two noun phrases "purchase price" and "goods" are both contained under the noun phrase "The purchase price for these goods", as identified by the Stanford parser. Thus, it would make sense when matching to only take into account what I refer to as base noun phrases, or noun phrases that don't have any other noun phrases contained within it. But this doesn't always work, because in this sentence for example:
"He incurred $23 thousand of costs related to office space and $10 thousand of costs related to office supplies."
The base noun phrases identified by the parser would be "costs" x2, "office supplies", and "office space". But none of these noun phrases properly describe the numbers "$23 thousand" and "10 thousand". We really need are the more general noun phrases "costs of office supplies" and "costs of office space" to adequately describe the numbers.
So I'm stuck in trying to figure out a method to extract noun phrases that aren't too broad or too specific, as shown by the last two examples. But so far, it just doesn't seem possible to develop a method that will work for all the different sentences out there. If someone could offer any advice on how to approach this problem, it would be greatly appreciated.
Thanks in advance for your time.