Skip to content
Snippets Groups Projects
Commit 80018fc3 authored by Joni Krebs's avatar Joni Krebs
Browse files

added postprocessiong for questions to fix some common mistakes

parent 7ec023a7
No related branches found
No related tags found
No related merge requests found
......@@ -8,6 +8,7 @@ import org.apache.uima.cas.CAS
import org.apache.uima.util.CasCreationUtils
import spark.Request
import spark.Response
import java.util.regex.Pattern
object Extractor {
fun extract(req: Request, res: Response): String {
......@@ -36,7 +37,7 @@ object Extractor {
modality = modality,
anamnesis = anamnesis,
diagnosis = anamnesis,
question = question,
question = postProcessQuestion(question),
notice = "",
pregnancy = pregnancy,
pregnancy_week = "",
......@@ -98,6 +99,15 @@ object Extractor {
return "nicht erhoben"
}
private fun postProcessQuestion(question: String): String {
val pattern = Pattern.compile("(?i)(termin|vielen dank)")
val matcher = pattern.matcher(question)
if (matcher.find()) {
return question.substring(0, matcher.start()).trim()
}
return question
}
private fun getAnamnesisQuestionFromPython(doctext: String): Pair<String, String> {
val url = "http://localhost:$pythonPort/predict"
try {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment