Skip to content
This repository has been archived by the owner on Feb 15, 2024. It is now read-only.

Commit

Permalink
Merge pull request #27 from rbart/sentenced
Browse files Browse the repository at this point in the history
Break out Sentencer from Sentenced
  • Loading branch information
schmmd committed Oct 17, 2013
2 parents 5534ea4 + 6b15ca2 commit daca5e9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,16 @@ case class DocumentSentence[S <: Sentence](sentence: S, offset: Int)
trait Sentenced[S <: Sentence] {
this: Document =>

def sentences: Stream[DocumentSentence[S]]
}

trait Sentencer[S <: Sentence] extends Sentenced[S] {
this: Document =>

def constructor(text: String): S
def sentencer: Segmenter

lazy val sentences: Stream[DocumentSentence[S]] =
override lazy val sentences: Stream[DocumentSentence[S]] =
sentencer(text).toStream.map { segment =>
DocumentSentence(constructor(segment.text), segment.offset)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ import java.io.BufferedInputStream
import java.io.FileInputStream
import java.util.zip.GZIPInputStream

class StanfordNer(private val classifier: AbstractSequenceClassifier[_]) extends Typer[Token]("Stanford", "Stanford") {
class StanfordNer(private val classifier: AbstractSequenceClassifier[_]) extends Typer[Token] {

override def name = "Stanford"
override def source = "Stanford"

def apply(seq: Seq[Token]) = {
val text = Tokenizer.originalText(seq)
import scala.collection.JavaConverters._
Expand Down

0 comments on commit daca5e9

Please sign in to comment.