From 798c51c472ba70ada8262c80d6563197f2fc38d8 Mon Sep 17 00:00:00 2001 From: John Lambert Date: Wed, 20 Nov 2024 12:27:02 -0500 Subject: [PATCH] small updated needed for Serval --- src/SIL.Machine/Corpora/AlignedWordPair.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/SIL.Machine/Corpora/AlignedWordPair.cs b/src/SIL.Machine/Corpora/AlignedWordPair.cs index cf25108c8..534b87f81 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;