java.lang.Object
com.scivicslab.pojoactor.core.ActorRef<PairsActor>
com.scivicslab.turingworkflow.workflow.IIActorRef<PairsActor>
com.scivicslab.turingworkflow.plugins.kanakanji.PairsActor
All Implemented Interfaces:
com.scivicslab.pojoactor.core.CallableByActionName, AutoCloseable

public class PairsActor extends com.scivicslab.turingworkflow.workflow.IIActorRef<PairsActor>
Actor that validates LLM output and writes kana-kanji pairs to a TSV file.

Supported actions:

  • openOutput - Open output TSV file and write header
  • checkHiragana - Validate that hiragana column contains hiragana; fails if not
  • writePairs - Write validated pairs to output (with page/source metadata)
  • closeOutput - Flush and close output file
  • Field Summary

    Fields inherited from class com.scivicslab.pojoactor.core.ActorRef

    actorName, actorSystem, object
  • Constructor Summary

    Constructors
    Constructor
    Description
    PairsActor(String name, com.scivicslab.turingworkflow.workflow.IIActorSystem system)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    com.scivicslab.pojoactor.core.ActionResult
    Validate that the LLM response has proper tab-separated format and that the hiragana column actually contains hiragana characters.
    com.scivicslab.pojoactor.core.ActionResult
    Close the output file.
    com.scivicslab.pojoactor.core.ActionResult
    openOutput(String filePath)
    Open the output TSV file.
    com.scivicslab.pojoactor.core.ActionResult
    setPageInfo(String pageInfo)
    Set page metadata (page number and source filename) for subsequent writePairs calls.
    com.scivicslab.pojoactor.core.ActionResult
    writePairs(String response)
    Write tab-separated pairs from the LLM response to the output file.

    Methods inherited from class com.scivicslab.turingworkflow.workflow.IIActorRef

    callByActionName, hasAnnotatedAction, invokeAnnotatedAction, parseFirstArgument

    Methods inherited from class com.scivicslab.pojoactor.core.ActorRef

    ask, ask, askNow, clearJsonState, clearPendingMessages, close, createChild, expandVariables, getJsonBoolean, getJsonInt, getJsonString, getJsonString, getLastResult, getName, getNamesOfChildren, getParentName, hasJson, hasJsonState, initLogger, isAlive, json, putJson, setLastResult, setParentName, system, tell, tell, tellNow, toStringOfJson, toStringOfYaml

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • PairsActor

      public PairsActor(String name, com.scivicslab.turingworkflow.workflow.IIActorSystem system)
  • Method Details

    • openOutput

      public com.scivicslab.pojoactor.core.ActionResult openOutput(String filePath)
      Open the output TSV file. Appends if file exists, creates if not. Writes header row on creation.
    • setPageInfo

      public com.scivicslab.pojoactor.core.ActionResult setPageInfo(String pageInfo)
      Set page metadata (page number and source filename) for subsequent writePairs calls. Argument format: "pageNum\tsourceFile"
    • checkHiragana

      public com.scivicslab.pojoactor.core.ActionResult checkHiragana(String response)
      Validate that the LLM response has proper tab-separated format and that the hiragana column actually contains hiragana characters. Returns failure if any tab-separated line has no hiragana in the left column. Returns success with the count of valid lines if all lines pass.
    • writePairs

      public com.scivicslab.pojoactor.core.ActionResult writePairs(String response)
      Write tab-separated pairs from the LLM response to the output file. Appends page and source columns. Skips lines without a tab.
    • closeOutput

      public com.scivicslab.pojoactor.core.ActionResult closeOutput(String args)
      Close the output file.