Page not found
63 | 64 |Sorry, but the page you were trying to get to, does not exist. You 65 | may want to try searching this site using the sidebar or using our 66 | API Reference page to find what 67 | you were looking for.
68 | 69 | 82 |├── test ├── test_helper.exs └── gc_nlp_test.exs ├── doc ├── fonts │ ├── icomoon.eot │ ├── icomoon.ttf │ ├── icomoon.woff │ └── icomoon.svg ├── index.html ├── .build ├── dist │ ├── sidebar_items.js │ ├── app-091c05798a.css │ └── app-574613960f.js ├── 404.html ├── api-reference.html ├── readme.html └── GcNLP.html ├── .gitignore ├── lib ├── gc_nlp │ └── application.ex ├── extra.ex └── gc_nlp.ex ├── mix.exs ├── config └── config.exs ├── README.md ├── mix.lock └── CONTRIBUTING.md /test/test_helper.exs: -------------------------------------------------------------------------------- 1 | ExUnit.start() 2 | -------------------------------------------------------------------------------- /doc/fonts/icomoon.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seymores/gc_nlp/HEAD/doc/fonts/icomoon.eot -------------------------------------------------------------------------------- /doc/fonts/icomoon.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seymores/gc_nlp/HEAD/doc/fonts/icomoon.ttf -------------------------------------------------------------------------------- /doc/fonts/icomoon.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seymores/gc_nlp/HEAD/doc/fonts/icomoon.woff -------------------------------------------------------------------------------- /doc/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 |Sorry, but the page you were trying to get to, does not exist. You 65 | may want to try searching this site using the sidebar or using our 66 | API Reference page to find what 67 | you were looking for.
68 | 69 | 82 |Provides wrapper functions for Google Cloud Natural Language API. 74 | See full doc here
75 |WARNING Experimental 82 | Advance NLP goodies here
83 |Elixir wrapper for Google Cloud Natural Language API. See Cloud Natural Language API
64 |Latest version 0.2.0 doc.
65 |The package can be installed as:
71 |Add gc_nlp to your list of dependencies in mix.exs:
def deps do
74 | [{:gc_nlp, "~> 0.2.1"}]
75 | end
76 | Ensure gc_nlp is started before your application:
def application do
79 | [applications: [:gc_nlp]]
80 | end
81 | Put your Google Cloud credential json file in ‘config/‘ or modify the appropriate Goth config. Refer to this guide to get your credential file. Default to expect “gcloud-secret.json” inside config directory.
83 |Sentiment Analysis
92 |iex> GcNLP.analyze_sentiment "There is a lot of new features coming in Elixir 1.4"
93 | %{"documentSentiment" => %{"magnitude" => 0.1, "polarity" => 1}, "language" => "en"}
94 |
95 | Entity Analysis
97 |iex> GcNLP.analyze_entities "There is a lot of new features coming in Elixir 1.4"
98 | %{"entities" => [%{"mentions" => [%{"text" => %{"beginOffset" => 41, "content" => "Elixir 1.4"}}], "metadata" => %{}, "name" => "Elixir 1.4", "salience" => 0.16144496, "type" => "OTHER"}], "language" => "en"}
99 | Syntactic Analysis
101 |iex> GcNLP.annotate_text "There is a lot of new features coming in Elixir 1.4"
102 | %{"documentSentiment" => %{"magnitude" => 0.1, "polarity" => 1}, "entities" => [%{"mentions" => [%{"text" => %{"beginOffset" => 41, "content" => "Elixir 1.4"}}], "metadata" => %{}, "name" => "Elixir 1.4", "salience" => 0.16144496, "type" => "OTHER"}], "language" => "en", "sentences" => [%{"text" => %{"beginOffset" => 0, "content" => "There is a lot of new features coming in Elixir 1.4"}}], "tokens" => [%{"dependencyEdge" => %{"headTokenIndex" => 1, "label" => "EXPL"}, "lemma" => "There", "partOfSpeech" => %{"tag" => "DET"}, "text" => %{"beginOffset" => 0, "content" => "There"}}, %{"dependencyEdge" => %{"headTokenIndex" => 1, "label" => "ROOT"}, "lemma" => "be", "partOfSpeech" => %{"tag" => "VERB"}, "text" => %{"beginOffset" => 6, "content" => "is"}}, ...}
103 | Provides wrapper functions for Google Cloud Natural Language API. 72 | See full doc here
73 | 74 |Finds named entities (currently finds proper names) in the text, entity types, salience, mentions for each entity, and other properties. See doc
98 |Finds named entities (currently finds proper names) in the text, entity types, salience, mentions for each entity, and other properties. See doc
107 |Advanced API that analyzes the document and provides a full set of text annotations, including semantic, syntactic, and sentiment information. See doc
116 |Finds named entities (currently finds proper names) in the text, entity types, salience, mentions for each entity, and other properties. See doc
153 |iex> GcNLP.analyze_entities "There is a lot of new features coming in Elixir 1.4"
159 | %{"entities" => [%{"mentions" => [%{"text" => %{"beginOffset" => 41, "content" => "Elixir 1.4"}}], "metadata" => %{}, "name" => "Elixir 1.4", "salience" => 0.16144496, "type" => "OTHER"}], "language" => "en"}
160 |
161 | Finds named entities (currently finds proper names) in the text, entity types, salience, mentions for each entity, and other properties. See doc
176 |iex> GcNLP.analyze_sentiment "There is a lot of new features coming in Elixir 1.4"
182 | %{"documentSentiment" => %{"magnitude" => 0.1, "polarity" => 1}, "language" => "en"}
183 |
184 | Advanced API that analyzes the document and provides a full set of text annotations, including semantic, syntactic, and sentiment information. See doc
205 |iex> GcNLP.annotate_text "There is a lot of new features coming in Elixir 1.4"
211 | %{"documentSentiment" => %{"magnitude" => 0.1, "polarity" => 1},
212 | "entities" => [%{"mentions" => [%{"text" => %{"beginOffset" => 41,
213 | "content" => "Elixir 1.4"}}], "metadata" => %{},
214 | "name" => "Elixir 1.4", "salience" => 0.16144496,
215 | "type" => "OTHER"}], "language" => "en",
216 | "sentences" => [%{"text" => %{"beginOffset" => 0,
217 | "content" => "There is a lot of new features coming in Elixir 1.4"}}],
218 | "tokens" => [%{"dependencyEdge" => %{"headTokenIndex" => 1,
219 | "label" => "EXPL"}, "lemma" => "There",
220 | "partOfSpeech" => %{"tag" => "DET"},
221 | "text" => %{"beginOffset" => 0, "content" => "There"}},
222 | %{"dependencyEdge" => %{"headTokenIndex" => 1, "label" => "ROOT"},
223 | "lemma" => "be", "partOfSpeech" => %{"tag" => "VERB"},
224 | "text" => %{"beginOffset" => 6, "content" => "is"}},
225 | %{"dependencyEdge" => %{"headTokenIndex" => 3, "label" => "DET"},
226 | "lemma" => "a", "partOfSpeech" => %{"tag" => "DET"},
227 | "text" => %{"beginOffset" => 9, "content" => "a"}},
228 | %{"dependencyEdge" => %{"headTokenIndex" => 1,
229 | "label" => "NSUBJ"}, "lemma" => "lot",
230 | "partOfSpeech" => %{"tag" => "NOUN"},
231 | "text" => %{"beginOffset" => 11, "content" => "lot"}},
232 | %{"dependencyEdge" => %{"headTokenIndex" => 3, "label" => "PREP"},
233 | "lemma" => "of", "partOfSpeech" => %{"tag" => "ADP"},
234 | "text" => %{"beginOffset" => 15, "content" => "of"}},
235 | %{"dependencyEdge" => %{"headTokenIndex" => 6, "label" => "AMOD"},
236 | "lemma" => "new", "partOfSpeech" => %{"tag" => "ADJ"},
237 | "text" => %{"beginOffset" => 18, "content" => "new"}},
238 | %{"dependencyEdge" => %{"headTokenIndex" => 4, "label" => "POBJ"},
239 | "lemma" => "feature", "partOfSpeech" => %{"tag" => "NOUN"},
240 | "text" => %{"beginOffset" => 22, "content" => "features"}},
241 | %{"dependencyEdge" => %{"headTokenIndex" => 6, "label" => "VMOD"},
242 | "lemma" => "come", "partOfSpeech" => %{"tag" => "VERB"},
243 | "text" => %{"beginOffset" => 31, "content" => "coming"}},
244 | %{"dependencyEdge" => %{"headTokenIndex" => 7, "label" => "PREP"},
245 | "lemma" => "in", "partOfSpeech" => %{"tag" => "ADP"},
246 | "text" => %{"beginOffset" => 38, "content" => "in"}},
247 | %{"dependencyEdge" => %{"headTokenIndex" => 8, "label" => "POBJ"},
248 | "lemma" => "Elixir", "partOfSpeech" => %{"tag" => "NOUN"},
249 | "text" => %{"beginOffset" => 41, "content" => "Elixir"}},
250 | %{"dependencyEdge" => %{"headTokenIndex" => 9, "label" => "NUM"},
251 | "lemma" => "1.4", "partOfSpeech" => %{"tag" => "NUM"},
252 | "text" => %{"beginOffset" => 48, "content" => "1.4"}}]}
253 |
254 | iex> GcNLP.annotate_text "Data science is the best name for this industry", false, false, true
255 | %{"documentSentiment" => %{"magnitude" => 0.8, "polarity" => 1}, "entities" => [], "language" => "en", "sentences" => [%{"text" => %{"beginOffset" => 0, "content" => "Data science is the best name for this industry"}}], "tokens" => []}
256 |
257 |