Skip to content

Commit

Permalink
The entities can be passed to the parse method as an option so the id…
Browse files Browse the repository at this point in the history
…entification is skipped
  • Loading branch information
EgoLaparra committed Jun 9, 2019
1 parent fe8ba3e commit f6ceb48
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -245,15 +245,15 @@ class TemporalNeuralParser(modelFile: Option[InputStream] = None) {
}


def extract(sourceText: List[String]): Annotation = {
val entities = identification(sourceText)
def extract(sourceText: List[String], givenEntities: Option[Entities] = None): Annotation = {
val entities = givenEntities.getOrElse(identification(sourceText))
val links = linking(entities)
val properties = complete(entities, links, cleanText(sourceText))
Annotation(entities, links, properties)
}

def parse(sourceText: List[String]): List[Data] = {
val annotations = extract(sourceText)
def parse(sourceText: List[String], givenEntities: Option[Entities] = None): List[Data] = {
val annotations = extract(sourceText, givenEntities)
val xml: List[Elem] = build(annotations)
val data = (xml zip cleanText(sourceText)).map(b => new Data(b._1, Some(b._2)))
data
Expand Down

0 comments on commit f6ceb48

Please sign in to comment.