Save fuzzy matches
This commit is contained in:
@@ -54,7 +54,18 @@
|
|||||||
// When an actorName is given, check for a voiced line to play.
|
// When an actorName is given, check for a voiced line to play.
|
||||||
// Otherwise, assume it is un-voiced super text
|
// Otherwise, assume it is un-voiced super text
|
||||||
(when (and actorName (< 0 (count voiceTracks)))
|
(when (and actorName (< 0 (count voiceTracks)))
|
||||||
(case (try (dictGet (dictGet voiceLines actorName) text) (catch [e] (print e) null))
|
(case
|
||||||
|
(let [voiceLineKey
|
||||||
|
(if (voiceLineMatches.exists text)
|
||||||
|
.value (voiceLineMatches.get text)
|
||||||
|
(FuzzyMapTools.bestMatch (dictGet voiceLines actorName) text false))]
|
||||||
|
(if voiceLineKey
|
||||||
|
{
|
||||||
|
(#when debug
|
||||||
|
(voiceLineMatches.put text (new JsonableString voiceLineKey)))
|
||||||
|
(dictGet (dictGet voiceLines actorName) voiceLineKey)
|
||||||
|
}
|
||||||
|
null))
|
||||||
((objectWith trackKey start end alts)
|
((objectWith trackKey start end alts)
|
||||||
(case (dictGet altIdx "$actorName $text")
|
(case (dictGet altIdx "$actorName $text")
|
||||||
(null
|
(null
|
||||||
@@ -88,7 +99,7 @@
|
|||||||
(if line.alts
|
(if line.alts
|
||||||
(for alt (the Array<Dynamic> line.alts) (objectWith [start alt.start end alt.end] trackKey))
|
(for alt (the Array<Dynamic> line.alts) (objectWith [start alt.start end alt.end] trackKey))
|
||||||
[])]
|
[])]
|
||||||
(unless (voiceLines.exists actorName)
|
(unless (voiceLines.existsExactly actorName)
|
||||||
(dictSet voiceLines actorName (new FuzzyMap<VoiceLine>)))
|
(dictSet voiceLines actorName (new FuzzyMap<VoiceLine>)))
|
||||||
(dictSet (dictGet voiceLines actorName) key (objectWith [start line.start end line.end] trackKey alts))))))
|
(dictSet (dictGet voiceLines actorName) key (objectWith [start line.start end line.end] trackKey alts))))))
|
||||||
|
|
||||||
|
|||||||
@@ -26,3 +26,5 @@
|
|||||||
(put key defaultVal))
|
(put key defaultVal))
|
||||||
(dictGet m key))
|
(dictGet m key))
|
||||||
|
|
||||||
|
(method exists [:String key]
|
||||||
|
(m.exists key))
|
||||||
Reference in New Issue
Block a user