Skip to content

Alignment Data Reducers Actions

Christopher Klapp edited this page Aug 29, 2017 · 1 revision

Overview

  • The definitive storage of the alignment data should be explicitly stored in the target language USFM (v3), so that there is no loss of synchronization.
  • Auxilary needs of alignment data may be more efficient to do a key/value lookup so that it doesn't have to explicitly parse the USFM.

Use Cases

  • Scripture Pane
    • Highlight quotes from more than 1 bible.
    • If Greek is the source of the check, use alignment data for the explicit GL verse to highlight the corresponding GL phrase.
    • Needs occurrence level alignments of current verse only.
  • tW tool (and others)
    • Multilingual check info card to display quote in more than one language.
    • If Greek is the source of the check, use alignment data for the explicit GL verse to display the corresponding GL phrase in the Check Info card.
    • Needs occurrence level alignments of current verse only.
  • Alignment Tool
    • Storing new alignments
      • Definitive storage in target USFM verse markup \w.
      • Also in the reducer for future lookups.
    • Predicting new alignments
      • Use pivoted alignments to find probable alignments.
      • An action that gets most common target phrase for each source phrase in the current verse.
    • Retrieving previous alignments (coming back to a completed verse)
      • Needs occurrence level alignments of current verse only.

Alignment Reducer

Alignment Reducer should be populated directly from the USFM text of the book/chapters in order to prevent the data from getting stale or out of date. There may be a potential performance hit on large books that can easily be improved by implementing filesystem persistence and explicitly calling an action to flush and regenerate by re-parsing the target language USFM.

Needs

  • Occurrence specific alignments for the current verse, in a way that eases implementation of actions that need it.
  • The larger context of all alignments in the project so that predictions can be made.

Data Structure Proposal

alignmentReducer = {
  currentVerse: [
    {
      sourcePhrase: source_phrase1,
      sourceOccurrence: 1,
      sourceOccurrences: 2,
      targetPhrase: target_phrase1,
      sourceOccurrence: 1,
      sourceOccurrences: 2
    },
    {
      sourcePhrase: source_phrase2,
      sourceOccurrence: 1,
      sourceOccurrences: 1,
      targetPhrase: target_phrase2,
      sourceOccurrence: 1,
      sourceOccurrences: 1
    },
    ...
  ],
  [bookId]: {
    [sourcePhrase]: {
      [targetPhrase]: [count]
    },
    ...
  }
}

Alignment Helpers

These are the helpers that can be created and tests created to ensure they work.

  • getAlignedTargetPhraseForVerse(sourcePhrase, occurrence)
    • Looks in the reducer for the explicit verse aligment.
    • returns { phrase: [targetPhrase], occurrence: [occurrence] }
  • getAlignedSourcePhraseForVerse(targetPhrase, occurrence)
    • Looks in the reducer for the explicit verse aligment.
    • returns { phrase: [sourcePhrase], occurrence: [occurrence] }
  • predictAlignedTargetPhrase(targetPhrase, sourceText, targetText)
    • Looks in the reducer for the most common alignments that occur in both sourceText and targetText.
    • returns { phrase: [targetPhrase] }