-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathparser.js
37 lines (27 loc) · 825 Bytes
/
parser.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
var an = require('./annotator'),
_ = require('lodash')
function getTerms(text, ontologies, cb){
// Get simple list of terms that matched
var terms
an.params['levelMax'] = 0
an.params['ontologiesToExpand'] = ontologies.join(',')
an.params['ontologiesToKeepInResult'] = ontologies.join(',')
an.getAnnotations(text, function(err, result){
terms = result.annotations.map(function(item){ return concept.context.term.concept.preferredName.$text})
//console.log(terms)
cb(null, terms)
})
}
function getAnnotations(text, ontologies, cb){
var contexts = []
an.params['max_level'] = 3
an.params['ontologies'] = ontologies.join(',')
an.getAnnotations(text, function(err, result){
//console.log(contexts)
cb(null, result)
})
}
module.exports = {
getTerms: getTerms,
getAnnotations: getAnnotations
}