Esempio n. 1
0
        /// <summary>
        /// Reads the orthography conversion settings file and applies the specified mapping to a list of strings
        /// </summary>
        /// <param name="fragments">The texts (as an IEnumerable<string>) to apply the mapping to</param>
        /// <param name="orthographyConversionFile">The filename containing the conversion settings. It should be tab-delimited with 2 columns. The 1st column is a sequence of 1 or more characters in the source language. The 2nd column contains a sequence of characteres to map to in the target language.</param>
        /// <returns></returns>
        public static IEnumerable <string> ApplyOrthographyConversion(IEnumerable <string> fragments, string orthographyConversionFile)
        {
            var converter = new OrthographyConverter(orthographyConversionFile);

            foreach (var fragment in fragments)
            {
                string mappedFragment = converter.ApplyMappings(fragment);
                yield return(mappedFragment);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Reads the orthography conversion settings file and applies the specified mapping to a piece of text
        /// </summary>
        /// <param name="text">The text (as a scalar string) to apply the mapping to</param>
        /// <param name="orthographyConversionFile">The filename containing the conversion settings. It should be tab-delimited with 2 columns. The 1st column is a sequence of 1 or more characters in the source language. The 2nd column contains a sequence of characteres to map to in the target language.</param>
        /// <returns></returns>
        public static string ApplyOrthographyConversion(string text, string orthographyConversionFile)
        {
            var converter = new OrthographyConverter(orthographyConversionFile);

            return(converter.ApplyMappings(text));
        }