gc_nlp v0.2.0 GcNLP

Provides wrapper functions for Google Cloud Natural Language API. See full doc here

Summary

Functions

Finds named entities (currently finds proper names) in the text, entity types, salience, mentions for each entity, and other properties. See doc

Finds named entities (currently finds proper names) in the text, entity types, salience, mentions for each entity, and other properties. See doc

Advanced API that analyzes the document and provides a full set of text annotations, including semantic, syntactic, and sentiment information. See doc

Functions

analyze_entities(text)

Finds named entities (currently finds proper names) in the text, entity types, salience, mentions for each entity, and other properties. See doc

Example

iex> GcNLP.analyze_entities "There is a lot of new features coming in Elixir 1.4"
%{"entities" => [%{"mentions" => [%{"text" => %{"beginOffset" => 41, "content" => "Elixir 1.4"}}], "metadata" => %{}, "name" => "Elixir 1.4", "salience" => 0.16144496, "type" => "OTHER"}], "language" => "en"} 
analyze_sentiment(text)

Finds named entities (currently finds proper names) in the text, entity types, salience, mentions for each entity, and other properties. See doc

Example

iex> GcNLP.analyze_sentiment "There is a lot of new features coming in Elixir 1.4"
%{"documentSentiment" => %{"magnitude" => 0.1, "polarity" => 1}, "language" => "en"}
annotate_text(text)

Advanced API that analyzes the document and provides a full set of text annotations, including semantic, syntactic, and sentiment information. See doc

Example

iex> GcNLP.annotate_text "There is a lot of new features coming in Elixir 1.4"
%{"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"}}, ...}