Comments (4)
the issue appears to occur during the mapping done by nlcstToString
from retext-keywords.
nlcst-to-string
does accept a second argument, the separator
, which is used to join stuff together.
This kind of looks like it could be accidentally passed by using someWords.map(nlcstStoString)
, but I don’t think that happens here or in retext-pos
? 🤔
from retext-keywords.
thanks for your tip @wooorm . I've found a workaround by using the lodash
module _.map
function - i'm not exactly sure why this works and the current method doesn't though 🙃.
please see the working example below:
var retext = require('retext');
var keywords = require('retext-keywords');
var nlcstToString = require('nlcst-to-string');
var _ = require('lodash');
var text = "Last night’s concert was the third in a series organised by the Lizz Hobbs Group, who have now produced concerts at Slessor Gardens two years in a row.";
retext()
.use(keywords)
.process(text, function (err, file) {
if (err) throw err;
console.log('Keywords:');
file.data.keywords.forEach(function (keyword) {
console.log(nlcstToString(keyword.matches[0].node));
});
console.log();
console.log('Key-phrases:');
file.data.keyphrases.forEach(function (phrase) {
//console.log(phrase.matches[0].nodes.map(nlcstToString).join(''));
var nodes = phrase.matches[0].nodes;
var tree = _.map(nodes);
console.log(nlcstToString(tree, ""));
});
}
);
which gives as expected:
Keywords:
concert
Last
night’s
third
series
Lizz
Hobbs
Group
Slessor
Gardens
two
years
row
Key-phrases:
Last night’s concert
Slessor Gardens two years
Lizz Hobbs Group
concerts
from retext-keywords.
Ah, I fixed the example in the readme. Thanks!
from retext-keywords.
Related Issues (18)
- Duplicates using the same word HOT 2
- Readme demo crashes against current retext HOT 6
- AWS Lambda Insights HOT 3
- Spanish HOT 5
- Not working with custom texts HOT 9
- What algorithm does this use? HOT 3
- Identify American English HOT 1
- TypeError: Cannot read property 'children' of undefined when using options HOT 1
- Phrases HOT 4
- Not working with head version of retext HOT 5
- Getting "it's" as a keyword HOT 4
- Error: Attempted import error: 'color' is not exported from 'unist-util-visit-parents/do-not-use-color' (imported as 'color'). HOT 2
- Stopwords that contain apostrophe are not filtered HOT 3
- TypeError: Cannot read property 'push' of undefined
- Russian language support HOT 3
- Version bump on retext-pos dependency? HOT 1
- United not a keyword HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from retext-keywords.