Skip to content
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

Make it compile #760

Merged
merged 1 commit into from
Oct 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions main/src/main/scala/org/clulab/odin/impl/ThompsonVM.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import org.clulab.processors.Document
import org.clulab.struct.Interval
import org.clulab.odin._

import scala.::
//import scala.::



Expand Down Expand Up @@ -39,22 +39,22 @@ object ThompsonVM {
def results: Seq[(NamedGroups, NamedMentions)]
}

private case class SingleThread(
case class SingleThread(
tok: Int,
inst: Inst,
dir: Direction,
groups: NamedGroups,
mentions: NamedMentions,
partialGroups: PartialGroups,
partialMatches: PartialMatches
var partialMatches: PartialMatches
) extends Thread {
def isDone: Boolean = inst == Done
def isReallyDone: Boolean = isDone
def results: Seq[(NamedGroups, NamedMentions)] = Seq((groups, mentions))
}


private case class ThreadBundle(bundles: Seq[Seq[Thread]]) extends Thread {
case class ThreadBundle(bundles: Seq[Seq[Thread]]) extends Thread {
// at least one thread is done and the threads after the threadbundle can be dropped
def isDone: Boolean = bundles.exists(_.exists(_.isDone))
// all bundles are done and we can retrieve the results
Expand Down Expand Up @@ -101,7 +101,7 @@ object ThompsonVM {
loop((i.next, gs + (name -> updatedGroups), ms, partials) :: rest, ts)
case _ => sys.error("unable to close capture")
}
case i => loop(rest, SingleThread(tok, i, dir, gs, ms, pgs) :: ts)
case i => loop(rest, SingleThread(tok, i, dir, gs, ms, pgs, List.empty[PartialMatch]) :: ts)
}
}
// return threads produced by `inst`
Expand Down Expand Up @@ -305,11 +305,11 @@ case class SaveStart(name: String) extends Inst {
def dup() = copy()
override def hashCode: Int = (name, super.hashCode).##

override def execute(thread: SingleThread): Unit = {
// Create a PartialMatch object and add it to the PartialMatches list
val partialMatch = PartialMatch(thread.sent, thread.tok, thread.tok, name)
thread.partialMatches = partialMatch :: thread.partialMatches
}
def execute(thread: ThompsonVM.SingleThread): Unit = {
// Create a PartialMatch object and add it to the PartialMatches list
val partialMatch = ThompsonVM.PartialMatch(thread.partialMatches.head.sentenceId, thread.tok, thread.tok, name)
thread.partialMatches = partialMatch :: thread.partialMatches
}


override def equals(other: Any): Boolean = {
Expand Down