/// <summary>
        /// Parses a text containing taxonids and return the corresponding taxa
        /// </summary>
        /// <param name="text">The text containing taxonids.</param>
        /// <param name="rowDelimiter">The row delimiter type.</param>
        /// <returns></returns>
        public List <ITaxon> GetMatchingTaxaFromText(string text, RowDelimiter rowDelimiter)
        {
            string[] stringArray = null;
            switch (rowDelimiter)
            {
            case RowDelimiter.ReturnLinefeed:
                stringArray = text.Split('\n');
                break;

            case RowDelimiter.Semicolon:
                stringArray = text.Split(';');
                break;

            case RowDelimiter.Tab:
                stringArray = text.Split('\t');
                break;

            case RowDelimiter.VerticalBar:
                stringArray = text.Split('|');
                break;

            default:
                stringArray = text.Split('\n');
                break;
            }
            stringArray = stringArray.Distinct().ToArray();
            return(GetMatches(stringArray));
        }
 public DelimitedTextDataset(
     string folderName,
     string fileName,
     string folderPath = default,
     ColumnDelimiter columnDelimiter   = default,
     RowDelimiter rowDelimiter         = default,
     EncodingName encodingName         = default,
     CompressionCodec compressionCodec = default,
     CompressionLevel compressionLevel = default,
     QuoteChar quoteChar         = default,
     EscapeChar escapeChar       = default,
     bool firstRowAsHeader       = false,
     string nullValue            = default,
     IList <SchemaColumn> schema = default)
 {
     FolderName       = folderName;
     FileName         = fileName;
     FolderPath       = folderPath;
     ColumnDelimiter  = columnDelimiter;
     RowDelimiter     = rowDelimiter;
     EncodingName     = encodingName;
     CompressionCodec = compressionCodec;
     CompressionLevel = compressionLevel;
     QuoteChar        = quoteChar;
     EscapeChar       = escapeChar;
     FirstRowAsHeader = firstRowAsHeader;
     NullValue        = nullValue;
     Schema           = schema;
 }
Beispiel #3
0
        public IEnumerable <string> EnumRows()
        {
            switch (RowDelimiter)
            {
            case RowDelimiterType.Lines:
                return(EnumRows_Lines());

            case RowDelimiterType.Separator:
                return(EnumRows_Separator());

            case RowDelimiterType.Limitation:
                return(EnumRows_Limitation());

            case RowDelimiterType.Regex:
                return(EnumRows_Regex());
            }
            throw new InternalError("DAE-00063 Unknown row delimiter:" + RowDelimiter.ToString());
        }
        /// <summary>
        /// Tries to parse the text into taxon ids and return a list of taxons.
        /// </summary>
        /// <param name="text">The text with taxonids.</param>
        /// <param name="rowDelimiter">The row delimiter type.</param>
        /// <returns></returns>
        public List <ITaxon> GetMatchingTaxaFromText(string text, RowDelimiter rowDelimiter)
        {
            var matchManager = new TaxonMatchManager(UserContext);

            return(matchManager.GetMatchingTaxaFromText(text, rowDelimiter));
        }