最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Identifying nouns in an array of string - Stack Overflow

programmeradmin7浏览0评论

I need to find a way to identify if an item in an array is a noun. I really can't think of any way to do this.

The first thing I did was ignore all words with "ly" in the end. But we know many words that aren't nouns doesn't have to have "ly" in the end. Is their a better way to do this? Is their a javascript library that can do this?

I need to find a way to identify if an item in an array is a noun. I really can't think of any way to do this.

The first thing I did was ignore all words with "ly" in the end. But we know many words that aren't nouns doesn't have to have "ly" in the end. Is their a better way to do this? Is their a javascript library that can do this?

Share Improve this question asked Aug 30, 2014 at 13:42 lightning_missilelightning_missile 3,0845 gold badges38 silver badges66 bronze badges 7
  • 1 might be you can connect one of these APIs wordnet.princeton.edu/wordnet/related-projects/#web – FreeCandies Commented Aug 30, 2014 at 13:47
  • Do you want all nouns? Or just proper nouns? If you want only proper nouns, checking if the word starts with a capital may be a not fully perfect but fairly okay solution ... – Martin Tournoij Commented Aug 30, 2014 at 13:47
  • This is not simple at all. Please read How can I extract words from a sentence and determine what part of speech each is?. – h2ooooooo Commented Aug 30, 2014 at 13:49
  • There are absolutely no rules in English that link spelling patterns to parts of speech. There are words that are both nouns and verbs ("fly"). – Pointy Commented Aug 30, 2014 at 13:49
  • @Carpetsmoker I need all nouns. – lightning_missile Commented Aug 30, 2014 at 13:51
 |  Show 2 more ments

2 Answers 2

Reset to default 4

I think you can use this

http://wordnet.princeton.edu/wordnet/man/wngloss.7WN.html

it has endpoints for JSON and XML (you can make a simple GET request for each word and get the type of the word from the responded json e.g.

http://chriscargile./dictionary/json/cow

What you're looking for is called a pos tagger. The pos node.js module does exactly that.

The natural nodejs module also es with a wordnet interface, which you can use.

发布评论

评论列表(0)

  1. 暂无评论