public void RemoveQuotesLines()
        {
            List <Token> newTokens = new List <Token>();

            for (int i = 0; i < tokens.Count; i++)
            {
                Token t = tokens[i];
                if (t.Word == "\"")
                {
                    TokenChainCollection chains = t.Chains;
                    foreach (TokenChain c in chains.Chains)
                    {
                        if (c.ChainPosition == TokenChainPosition.Close)
                        {
                            tokens[i - 1].AddTokenChain(c.ChainNumber, c.ChainPosition);     // move to previous token
                        }
                        else if (c.ChainPosition == TokenChainPosition.Open)
                        {
                            tokens[i + 1].AddTokenChain(c.ChainNumber, c.ChainPosition);     // move to next token
                        }
                        else
                        {
                            throw new Exception("Unexpected chain position");
                        }
                    }
                }
                else
                {
                    newTokens.Add(t);
                }
            }

            tokens = newTokens;
        }
Beispiel #2
0
 public Token(string line)
 {
     tokens = new string[8];
     string[] columns = line.Split('\t');
     Array.Copy(columns, this.tokens, 8);
     Chains = new TokenChainCollection(columns[8]);
 }