-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optional text input files #28
Conversation
XML.fromSource(io.Source.fromFile(xmlPath)), | ||
io.Source.fromFile(textPath).mkString) | ||
def apply(xml: Elem, text: String) = new Data(xml, text) | ||
def fromPaths(xmlPath: String, textPath: Option[String]) =textPath match { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this could be more concisely written as:
apply(XML.fromSource(io.Source.fromFile(xmlPath)), textPath.map(p => io.Source.fromFile(p).mkString)
def text(implicit data: Data): String = spans.map{ | ||
case (start, end) => data.text.substring(start, end) | ||
}.mkString("...") | ||
def text(implicit data: Data): Option[String] = data.text match { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this could be more concisely written as:
data.text.map(text => spans.map {
case (start, end) => text.substring(start, end)
}.mkString("..."))
@@ -26,7 +26,7 @@ case class FractionalNumber(number: Int, numerator: Int, denominator: Int) exten | |||
val isDefined = true | |||
} | |||
|
|||
case class VagueNumber(description: String) extends Number { | |||
case class VagueNumber(description: Option[String]) extends Number { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't make VagueNumber
take an Option[String]
. Rather, in your scorer where the value of the VagueNumber
doesn't matter, just pass some meaningless value. Something like entity.text.getOrElse("")
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. Should I do the same with Event and TimeZone?
Yes, that's right.
On Aug 8, 2017 09:47, EgoLaparra <notifications@github.com> wrote:
@EgoLaparra commented on this pull request.
________________________________
In src/main/scala/info/bethard/timenorm/formal/Types.scala<#28 (comment)>:
@@ -26,7 +26,7 @@ case class FractionalNumber(number: Int, numerator: Int, denominator: Int) exten
val isDefined = true
}
…-case class VagueNumber(description: String) extends Number {
+case class VagueNumber(description: Option[String]) extends Number {
Ok. Should I do the same with Event and TimeZone?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub<#28 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/ABERhwKxdb4VGzKs7DqefU2bmPzZlwL0ks5sWJE8gaJpZM4Ow96R>.
|
No description provided.