Exemple #1
0
        static void Main(string[] args)
        {
            Console.WriteLine(GenericCollections.About);

            var stringDictionary = new StringDictionary();

            stringDictionary.Add(7, "Irena");
            stringDictionary.Add(4, "Sammy");
            stringDictionary.Add(25, "Ben");
            stringDictionary.Add(42, "Seth");
            stringDictionary.Add(97, "Ken");
            stringDictionary.Add(55, "Kellan");
            stringDictionary.Add(3, "Chris");

            var a = stringDictionary.Get(42);

            Console.WriteLine($"The person with the fav nbr of 42 is {stringDictionary.Get(42)}");

            foreach (var data in stringDictionary.Values())
            {
                Console.WriteLine(data);
            }

            var strings = new StringList();

            strings.Add("abc");
            strings.Add("def");
            strings.Add("ghi");
            strings.Add("xxx", "yyy");
            strings.Add("aaa", "bbb", "ccc", "ddd", "eee", "fff");
            foreach (var str in strings)
            {
                Console.WriteLine(str);
            }
        }
 /// <summary>Constructs an AceToken from a tokenized line generated by Tokey</summary>
 public AceToken(string word, string lemma, string pos, string chunk, string nerc, string start, string end, int sentence)
 {
     mLiteral = word;
     if (word == null)
     {
         mWord     = -1;
         mCase     = -1;
         mSuffixes = null;
     }
     else
     {
         mWord     = Words.Get(RemoveSpaces(word), false);
         mCase     = DetectCase(word);
         mSuffixes = ExtractSuffixes(word);
     }
     if (lemma == null)
     {
         mLemma = -1;
     }
     else
     {
         mLemma = Lemmas.Get(RemoveSpaces(lemma), false);
     }
     if (pos == null)
     {
         mPos = -1;
     }
     else
     {
         mPos = Others.Get(pos, false);
     }
     if (chunk == null)
     {
         mChunk = -1;
     }
     else
     {
         mChunk = Others.Get(chunk, false);
     }
     if (nerc == null)
     {
         mNerc = -1;
     }
     else
     {
         mNerc = Others.Get(nerc, false);
     }
     if (start != null && end != null)
     {
         mByteOffset    = new Span(System.Convert.ToInt32(start), System.Convert.ToInt32(end));
         mRawByteOffset = new Span(System.Convert.ToInt32(start), System.Convert.ToInt32(end));
     }
     mSentence   = sentence;
     mMassiClass = string.Empty;
     mMassiBbn   = string.Empty;
     mMassiWnss  = string.Empty;
 }
Exemple #3
0
        /// <summary>
        /// Register filesystems
        /// </summary>
        /// <param name="filesystem">Filesystem</param>
        /// <param name="name">Name</param>
        public static void RegisterFilesystem(IFilesystem filesystem, string name)
        {
            if (mFilesystems.Get(name) != null)
            {
                return;
            }

            mFilesystems.Add(name, filesystem);
        }
Exemple #4
0
        public static PacketFSEntry GetEntryByName(string name)
        {
            m_mutex.Lock();

            PacketFSEntry entry = (PacketFSEntry)m_children.Get(name);

            m_mutex.Unlock();

            return(entry);
        }
Exemple #5
0
        /// <summary>
        /// Remove a entry
        /// </summary>
        /// <param name="name">Name of entry</param>
        /// <returns>Success?</returns>
        public bool RemoveEntry(string name)
        {
            if (m_children.Get(name) == null)
            {
                return(false);
            }

            m_children.Remove(name);

            return(true);
        }
Exemple #6
0
        static void Main(string[] args)
        {
            var stringDictionary = new StringDictionary();

            stringDictionary.Add(7, "Irene");
            stringDictionary.Add(4, "Sammy");
            stringDictionary.Add(25, "Ben");
            stringDictionary.Add(42, "Seth");
            stringDictionary.Add(97, "Ken");
            stringDictionary.Add(55, "Kellen");
            stringDictionary.Add(3, "Chris");

            Console.WriteLine($"The person with Key # 42 is {stringDictionary.Get(42)}");

            foreach (var Name in stringDictionary.Names())
            {
                Console.WriteLine(Name);
            }

            var strings = new StringList();

            strings.Add("ABC");
            strings.Add("DEF");
            strings.Add("GHI");
            strings.Add("jklm", "nopq", "rstu", "vwxyz");

            foreach (var str in strings)
            {
                Console.WriteLine(str);
            }
        }
Exemple #7
0
        static void Main(string[] args)
        {
            Console.WriteLine(GenericCollections.About);

            var stringDictionary = new StringDictionary();

            stringDictionary.Add(7, "Irena");
            stringDictionary.Add(4, "Sammy");
            stringDictionary.Add(25, "Ben");
            stringDictionary.Add(42, "Seth");
            stringDictionary.Add(97, "Ken");
            stringDictionary.Add(55, "Kellan");
            stringDictionary.Add(3, "Chris");

            //var a = stringDictionary.Get(42);

            Console.WriteLine($"The person with the fav nbr of 42 is{stringDictionary.Get(42)}");

            foreach (var data in stringDictionary.Values())
            {
                Console.WriteLine(data);
            }
            var strings = new StringListClass();

            strings.Add("ABC");
            strings.Add("DEF");
            strings.Add("GHI");
            strings.Add("XXX", "YYY");
            strings.Add("aaa", "bbb", "ccc", "ddd");

            foreach (var str in strings)
            {
                Console.WriteLine(str);
            }
        }
        /// <summary>
        /// Loads all proximity classes from the hard disk The WORDS map must be
        /// created before!
        /// </summary>
        /// <exception cref="System.IO.IOException"/>
        public static void LoadProximityClasses(string proxFileName)
        {
            log.Info("Loading proximity classes...");
            BufferedReader @in = null;

            try
            {
                @in = new BufferedReader(new FileReader(proxFileName));
            }
            catch (IOException)
            {
                log.Info("Warning: no proximity database found.");
                return;
            }
            string line;

            while ((line = @in.ReadLine()) != null)
            {
                List <string> tokens = SimpleTokenize.Tokenize(line);
                if (tokens.Count > 0)
                {
                    int        key   = Words.Get(tokens[0]);
                    List <int> value = new List <int>();
                    for (int i = 0; i < tokens.Count && i < ProximityClassSize; i++)
                    {
                        int word = Words.Get(tokens[i]);
                        value.Add(word);
                    }
                    ProxClasses[key] = value;
                }
            }
            @in.Close();
            log.Info("Finished loading proximity classes.");
        }
        static void Main(string[] args)
        {
            Console.WriteLine(GenericCollections.About);

            var strDictionary = new StringDictionary();

            strDictionary.Add(7, "Irena");
            strDictionary.Add(4, "Sammy");
            strDictionary.Add(25, "Ben");
            strDictionary.Add(42, "Seth");
            strDictionary.Add(97, "Ken");
            strDictionary.Add(55, "Kellan");
            strDictionary.Add(3, "Chris");

            Console.WriteLine($"The person with the fav nbr of 42 is {strDictionary.Get(42)}");

            foreach (var i in strDictionary.Values())
            {
                Console.WriteLine(i);
            }


            var strings = new StringList();

            strings.Add("abc");
            strings.Add("def");
            strings.Add("ghi");
            strings.Add("xxx", "yyy");
            strings.Add("xxx", "yyy", "lll");
            strings.Add("xxx", "yyy", "lll", "rrr");
            strings.Count();
            foreach (var i in strings)
            {
                Console.WriteLine(i);
            }
        }
Exemple #10
0
 public static string GetParam(string name)
 {
     return((string)mParams.Get(name));
 }