diff --git a/src/SIL.Machine/Corpora/AlignedWordPair.cs b/src/SIL.Machine/Corpora/AlignedWordPair.cs index cf25108c..534b87f8 100644 --- a/src/SIL.Machine/Corpora/AlignedWordPair.cs +++ b/src/SIL.Machine/Corpora/AlignedWordPair.cs @@ -23,6 +23,20 @@ public static IReadOnlyCollection Parse(string alignments, bool return result; } + public static bool TryParse(string alignments, out IReadOnlyCollection alignedWordPairs) + { + alignedWordPairs = null; + try + { + alignedWordPairs = Parse(alignments); + return true; + } + catch + { + return false; + } + } + public AlignedWordPair(int sourceIndex, int targetIndex) { SourceIndex = sourceIndex;