rbehzadan / opennlp-service Goto Github PK
View Code? Open in Web Editor NEWRESTful API for Apache OpenNLP Library
License: MIT License
RESTful API for Apache OpenNLP Library
License: MIT License
consider this request:
curl http://localhost -d 'All of my drawing when I was an art major lol smh ๐ญ'
results in this response:
{"sentences":[{"body":"All of my drawing when I was an art major lol smh \uD83D\uDE2D","chunks":[{"body":"All","end":1,"label":"NP","start":0},{"body":"of","end":2,"label":"PP","start":1},{"body":"my drawing","end":4,"label":"NP","start":2},{"body":"when","end":5,"label":"ADVP","start":4},{"body":"I","end":6,"label":"NP","start":5},{"body":"was","end":7,"label":"VP","start":6},{"body":"an art major lol smh \uD83D","end":13,"label":"NP","start":7}],"namedEntities":[],"parses":["(TOP (NP (NP (NP (DT All)) (PP (IN of) (NP (PRP$ my) (NN drawing)))) (SBAR (WHADVP (WRB when)) (S (NP (PRP I)) (VP (VBD was) (NP (DT an) (NN art) (JJ major) (NN lol) (NN smh))))) (. \uD83D\uDE2D)))"],"tokens":[{"body":"All","partOfSpeech":"DT"},{"body":"of","partOfSpeech":"IN"},{"body":"my","partOfSpeech":"PRP$"},{"body":"drawing","partOfSpeech":"NN"},{"body":"when","partOfSpeech":"WRB"},{"body":"I","partOfSpeech":"PRP"},{"body":"was","partOfSpeech":"VBD"},{"body":"an","partOfSpeech":"DT"},{"body":"art","partOfSpeech":"NN"},{"body":"major","partOfSpeech":"JJ"},{"body":"lol","partOfSpeech":"NN"},{"body":"smh","partOfSpeech":"NN"},{"body":"\uD83D","partOfSpeech":"NN"},{"body":"\uDE2D","partOfSpeech":"."}]}]}
which looks good at first. the emoji is correctly encoded in the JSON body attribute as \uD83D\uDE2D
, however later on in the chunking process, it breaks the multibyte character in half (maybe because it views it as punctuation or something ๐คทโโ ) with:
{"body":"an art major lol smh \uD83D","end":13,"label":"NP","start":7}
and so the result that's returned for JSON encoding is just \uD83D
which is no longer valid JSON. when trying to parse it with jq or even php's json_decode
crashes with error:
parse error: Invalid \uXXXX\uXXXX surrogate pair escape at line 1, column 417
see also related issue: https://stackoverflow.com/a/42461709/4233593
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.