forked from Jcharis/Natural-Language-Processing-Tutorials
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
65 lines (42 loc) · 1.55 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<!DOCTYPE html>
<html>
<head>
<title>NLP with JavaScript</title>
<script src="https://unpkg.com/compromise@latest/builds/compromise.min.js"></script>
<script type="text/javascript">
var docx = nlp("Jack Ryan is a CIA Analyst in New York");
console.log(docx.data());
// Sentences
console.log(docx.sentences().data());
// Tokenization
console.log(docx.sentences().terms().out('array'));
// Part of Speech Tagging + Entities
console.log(docx.sentences().terms().out('tags'));
// Entity Recognition NER
console.log(docx.topics().data());
// Entity Recognition (NER) For People
console.log(docx.topics().people().text());
console.log(docx.people().text());
// Entity Recognition (NER) Firstname & last name
console.log(docx.people().firstNames().text());
console.log(docx.people().lastNames().text());
// Entity Recognition (NER) For Places
console.log(docx.places().text());
console.log(docx.topics().places().text());
// Entity Recognition (NER) For Organizations
console.log(docx.topics().organizations().text());
// Working with Nouns & Verbs
console.log(docx.nouns().text());
console.log(docx.verbs().data());
var docx2 = nlp("book");
console.log(docx2.nouns().toLowerCase().text());
console.log(docx2.nouns().toUpperCase().text());
console.log(docx2.nouns().toPlural().text());
</script>
</head>
<body>
<div style="background-color:silver;height:50px;padding:5px;text-align: center;">
<h2>NLP with JavaScript</h2>
</div>
</body>
</html>