first commit

This commit is contained in:
Pedro G. Galaviz
2019-11-28 20:55:32 -06:00
parent bde5ae77c1
commit 4a99a58085
63 changed files with 6227 additions and 174 deletions

20
src/utils/extract.js Normal file
View File

@@ -0,0 +1,20 @@
// Returns an Indexed Array with URL, mention and hashtag
// entities found in text.
import extractMentions from './extractMentions'
import extractHashtags from './extractHashtags'
import extractUrls from './extractUrls'
import removeOverlappingEntities from './removeOverlappingEntities'
export default function (text, options) {
const entities = extractUrls(text, options)
.concat(extractMentions(text))
.concat(extractHashtags(text))
if (entities.length === 0) {
return []
}
removeOverlappingEntities(entities)
return entities
}