TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

A cool way to use natural language in JavaScript

517 pointsby ooriabout 9 years ago

17 comments

ooriabout 9 years ago
<p><pre><code> nlp.statement(&#x27;She sells seashells&#x27;).negate().text() &#x2F;&#x2F; She doesn&#x27;t sell seashells nlp.sentence(&#x27;I fed the dog&#x27;).replace(&#x27;the [Noun]&#x27;, &#x27;the cat&#x27;).text() &#x2F;&#x2F; I fed the cat nlp.text(&quot;Tony Hawk did a kickflip&quot;).people(); &#x2F;&#x2F; [ Person { text: &#x27;Tony Hawk&#x27; ..} ]</code></pre>
评论 #11696063 未加载
评论 #11697366 未加载
评论 #11698531 未加载
评论 #11698335 未加载
hegivorabout 9 years ago
Perhaps I am misunderstanding the example but isn&#x27;t the date parsing result from the API documentation incorrect.<p><pre><code> nlp.value(&quot;I married April for the 2nd time on June 5th 1998 &quot;).date() &#x2F;&#x2F; [Date object] d.toLocaleString() -&gt; &quot;04&#x2F;2&#x2F;1998&quot; </code></pre> <a href="https:&#x2F;&#x2F;github.com&#x2F;nlp-compromise&#x2F;nlp_compromise&#x2F;blob&#x2F;master&#x2F;docs&#x2F;api.md#date-parsing" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;nlp-compromise&#x2F;nlp_compromise&#x2F;blob&#x2F;master...</a>
评论 #11696249 未加载
评论 #11697178 未加载
评论 #11696762 未加载
guptaneilabout 9 years ago
Hmm this example is interesting:<p><pre><code> nlp.person(&quot;Tony Hawk&quot;).pronoun(); &#x2F;&#x2F; &#x27;he&#x27; </code></pre> I was curious how it handled gender neutral names, since being able to identify gender from a name would be an awesome UX win. I tried a variety of different names, and for gender neutral names (ie &quot;Alex&quot; or &quot;Taylor&quot;), it always picked &quot;he&quot;. If it doesn&#x27;t recognize the name (ie &quot;Alexa&quot;), it returns &quot;they&quot;. Unfortunately, it only recognizes very standard American names. Anything remotely ethnic (ie &quot;Anjali&quot;) or slightly uncommon (ie &quot;Nate&quot;) results in a &quot;they&quot;.<p>Not picking on the library, since this would be an impossible task even for a human, but it seems odd to have used pronoun identification as one of the headline examples.<p>Anyway, awesome library overall. This could pair well with a dedicated date parsing library like Sherlock[1] to create some pretty cool conversational UI elements.<p>1: <a href="https:&#x2F;&#x2F;github.com&#x2F;neilgupta&#x2F;sherlock" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;neilgupta&#x2F;sherlock</a>
评论 #11697194 未加载
评论 #11697529 未加载
评论 #11697456 未加载
rolfvandekrolabout 9 years ago
Why is NLP these days equivalent of Natural English Language Processing? There are much more languages in the world.
评论 #11696025 未加载
评论 #11696154 未加载
评论 #11697373 未加载
评论 #11697350 未加载
评论 #11696196 未加载
评论 #11697108 未加载
评论 #11696107 未加载
fiatjafabout 9 years ago
How would I proceed to turn<p>&quot;this library is great.&quot; into &quot;all other libraries aren&#x27;t great.&quot; ?<p><a href="https:&#x2F;&#x2F;tonicdev.com&#x2F;5716bedc1dd0391100f67570&#x2F;57372d9625c9be1100f23823" rel="nofollow">https:&#x2F;&#x2F;tonicdev.com&#x2F;5716bedc1dd0391100f67570&#x2F;57372d9625c9be...</a>
BinaryIdiotabout 9 years ago
This library is fantastic. I&#x27;ve used in some side projects and while it&#x27;s far from perfect it hits that &quot;good enough&quot; space pretty well.
pknerdabout 9 years ago
Is there something similar available for PHP || Python?
gcrabout 9 years ago
This could be great for foreign language learners!<p>Imagine integrating this into Anki: &quot;Please negate this sentence&quot;, &quot;Please turn this sentence into past tense&quot;, &quot;What&#x27;s the direct object&quot;, and so on.<p>Perhaps &quot;this sentence&quot; could refer to some interesting sentence from an article that you read in Pocket last week, for example!
iamgopalabout 9 years ago
What a day it would be, when nlp natively supported in browsers and os.
评论 #11696304 未加载
fizzbatterabout 9 years ago
Anyone know of any good Rust libraries in the NLP landscape? It seems quite dead in Rust. Only partial libraries, and non-compilable libraries.
marknadalabout 9 years ago
Wow, this is an excellent README if I have ever seen one. And the project is most excellent as well. Great work.
rattrayabout 9 years ago
Can anyone explain how this works?
0b01about 9 years ago
Title is misleading clickbait. Should be &#x27;to process natural language.&#x27; or a cool way to use NLP.
moiociabout 9 years ago
Somebody has to point out that the past participle of swim is swum, not swam. (&#x2F;pedantic-mode)
MrBraabout 9 years ago
What&#x27;s so cool about this in a way it hasn&#x27;t been cool before?
58028641about 9 years ago
Instead of trying to train computers to parse our langueges, why don&#x27;t we improve our languages so that they are unambigious and each word has one meaning and each meaning only has one word. If only there was one universal language that had no exceptions.
评论 #11698243 未加载
评论 #11698222 未加载
评论 #11698234 未加载
评论 #11698235 未加载
MrBraabout 9 years ago
Wow, and why exactly did this make into HN first page? Because it&#x27;s Javascript?
评论 #11698821 未加载