简体   繁体   中英

How to check whether a phrase “functions” as noun in a sentence

In addition to noun and noun phrase, there are some other constructs in English that can also function as noun. Gerundive, for example, can be used as noun: you need good habits such as "being polite".

In an app I'm developing, I need to find all the components functioning as noun. I tried various chunking tools (NLTK, etc.) but they all seem to only recognize noun and noun phrase and not anything else.

These clunkers also don't recognize complements as part of NP, for example, "the fact that she's alive" will not be a single chunk even though they together act as noun in this sentence.

Is there any tool that can do trick like this?

Thanks.

I'm afraid having such control will require a proper statistical parser; for example, Stanford Parser gives the following tree for your sample sentence:

(ROOT
  (NP (DT the) (NN fact)
    (SBAR (IN that)
      (S
        (NP (PRP she))
        (VP (VBZ is)
          (ADJP (JJ alive)))))
    (. .)))

recognizing that the whole segment is an NP. For the case of gerundive:

(ROOT
  (S
    (VP (VB thank)
      (NP (PRP you))
      (PP (IN for)
        (NP (NN listening))))
    (. .)))

Stanford parser provides an API you can use from your app.

Since SyntaxNet produces dependency parse trees, you would need to write some heuristics to get such information. A constituency parser could give you this information more directly, but would be lacking information about the role that the nodes play in the tree (for example, you wouldn't know whether the NP is the subject of the verb or the direct object).

@Roy I agree with Slav as I had the problem with the word "open" . in my sentence "open" was imperative verb but syntaxnet marked it as adjective. I was not a computer science and I wrote a very simple and basic algorithm for fixing the problem you can see it here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM