Reputation: 562
I am using Google Natural Language API for sentiment analysis. I have an array of string texts that I concatenate and send to google to get sentiment values for each sentiment, but Google has its own idea on where the sentences start and end, so getting scrambled sentiment results and a different count of sentiment scores, then sent sentences.
If you could only set a flag like <sentence> </sentence>
for each phrase you would like to treat as a separate sentence - that would be great, but docs don't have info about it.
P.S. I am using it this(sending a chunk and not doing a separate API request for each sentence) way because I have thousands of sentences and latency is important.
Upvotes: 2
Views: 193
Reputation: 1424
With Google Natural Language API, a way to mark separate sentences that seems to work (although not officially documented) is to set the document type to HTML
and end each sentence with .<br>
(full-stop and HTML line break tag) to hint an end-of-sentence to the parser.
Upvotes: 0