Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/AleksiKnuutila/nlp-highlight
Semantic highlighting of natural language for readability
https://github.com/AleksiKnuutila/nlp-highlight
Last synced: 2 months ago
JSON representation
Semantic highlighting of natural language for readability
- Host: GitHub
- URL: https://github.com/AleksiKnuutila/nlp-highlight
- Owner: AleksiKnuutila
- Created: 2016-09-25T10:26:35.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-09-25T20:57:15.000Z (over 8 years ago)
- Last Synced: 2024-08-02T20:48:02.243Z (5 months ago)
- Language: JavaScript
- Size: 1.62 MB
- Stars: 12
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome - AleksiKnuutila/nlp-highlight - Semantic highlighting of natural language for readability (JavaScript)
README
# nlp-highlight
Semantic highlighting of natural language for readabilityProgrammers in particular are familiar with *syntax highlighting* of programming languages, colouring text to indicate the syntactical significance of words and characters. This project is a brief experiment to see whether a similar approach could improve readability of natural language.
My hypothesis is that for such highlighting to be useful, it would have to be based on the right kind of semantic distinctions, instead of syntactical ones. Adding semantic metadata to text is a hard problem, but current NLP tools have at least an indicative level of accuracy.
The demo uses the NLP SaaS TextRazor, and particularly the classifications in its entity recognition API. To make the interpretation of the highlighting sufficiently simple, the classifications are mapped to five semantic categories: people, organisations, places, numbers and quotes.
## Usage
`scripts/getjson.js` makes a request from the TextRazor API and saves the result as JSON that is later consumed to do the highlighting. The script takes the TextRazor API key as an argument, reads the analysed text from standard input and prints the JSON. An example of usage is:
```
cat article.txt | node scripts/getjson.js api-key > assets/article-analysed.js
```The location of the JSON data is indicated in the first lines of `app.js`.
To compile the demo, run:
```
npm install
gulp
```## Demo
https://aleksiknuutila.github.io/nlp-highlight/