wordmap
Version:
Multi-Lingual Word Alignment Prediction
62 lines (61 loc) • 2.37 kB
TypeScript
import { Token } from "wordmap-lexer";
import Alignment from "./structures/Alignment";
import Suggestion from "./structures/Suggestion";
/**
* Multi-Lingual Word Alignment Prediction
*/
export default class WordMap {
private engine;
constructor(opts?: {});
/**
* Adds an array of corpus
* @param {string[][]} corpus
*/
appendCorpus(corpus: string[][]): void;
/**
* Add corpus to the MAP.
* These may be single sentences or multiple sentence delimited by new lines.
* @param {string} source
* @param {string} target
*/
appendCorpusString(source: string, target: string): void;
/**
* Adds tokenized corpus to map
* @param sourceTokens
* @param targetTokens
*/
appendCorpusTokens(sourceTokens: Token[][], targetTokens: Token[][]): void;
/**
* Appends alignment memory engine.
* @param alignments - an alignment or array of alignments
*/
appendAlignmentMemory(alignments: Alignment | Alignment[]): void;
/**
* Appends some alignment memory.
* This may be multiple lines of text or a single line.
*
* @param {string} source - a string of source phrases separated by new lines
* @param {string} target - a string of target phrases separated by new lines
* @return {Alignment[]} an array of alignment objects (as a convenience)
*/
appendAlignmentMemoryString(source: string, target: string): Alignment[];
/**
* Predicts the word alignments between the sentences.
* @param {string} sourceSentence - a sentence from the source text
* @param {string} targetSentence - a sentence from the target text
* @param {number} maxSuggestions - the maximum number of suggestions to return
* @return {Suggestion[]}
*/
predict(sourceSentence: string | Token[], targetSentence: string | Token[], maxSuggestions?: number): Suggestion[];
/**
* Predicts word alignments between the sentences.
* Returns an array of suggestions that match the benchmark.
*
* @param {string} sourceSentence
* @param {string} targetSentence
* @param {Suggestion} benchmark
* @param {number} maxSuggestions
* @return {Suggestion[]}
*/
predictWithBenchmark(sourceSentence: string, targetSentence: string, benchmark: Alignment[], maxSuggestions?: number): Suggestion[];
}