0

Im trying to create a XML of inverted document index of words from a string list but unable to convert all the strings to FSharpList<> and get this exception at certain iterations:

EDIT Message: A first chance exception of type 'System.Exception' occurred in FSharp.Core.dll. The program is executed without a problem but XML is faulty as all the words are words are not accessed.

I can't undertstand why it works for some strings but not the others.

I use the code here to convert the list to FSharp: http://lookingsharp.wordpress.com/2011/03/08/converting-an-ilist-to-an-fsharplist/

Is it because I create the var fsharpList2 within the foreach?

ToFSharpList() function converts a C# list to a F# list.

        foreach (string st in doclist)
        {
            list3.Clear();
            split = st.Split(' ');
            foreach (string str in split)
            {
                if (str != null)
                    try
                    {
                        list3.Add(Module2.stem(str.ToLower())); //using stemmer written in F#
                    }
                    catch
                {
                    list3.Add(str.ToLower());
                }
            }


            //foreach(string str in list3)
            //richTextBox1.Text += str;


                var fsharpList2 = list3.ToFSharpList(); //to convert list of stemmed distinct words to FSharpList
                var perdoc_without_stopword = Module2.stopword(fsharpList2);    //Using Stopword to remove stopwords in the list
                foreach (string str in perdoc_without_stopword)
                    all_processes_words.Add(str);

                all_processes_words.Count();


                var list5 = WordFrequencyUtils.CountWordFrequencies(perdoc_without_stopword); //Calculating word frequencies }

EDIT Debug Outputs (The last line keeps repeating):

    'Amazon.ECS.SampleApp.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Users        \sid\Desktop\AmazonProductAdvertisingAPI\Amazon.ECS.SampleApp\bin\Debug\stopstem.dll', Symbols loaded.
    'Amazon.ECS.SampleApp.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Users        \sid\Desktop\AmazonProductAdvertisingAPI\Amazon.ECS.SampleApp\bin\Debug\Library1.dll',         Symbols loaded.
    A first chance exception of type 'System.Exception' occurred in FSharp.Core.dll
    A first chance exception of type 'System.Exception' occurred in FSharp.Core.dll
    A first chance exception of type 'System.Exception' occurred in FSharp.Core.dll
    A first chance exception of type 'System.Exception' occurred in FSharp.Core.dll
    A first chance exception of type 'System.Exception' occurred in FSharp.Core.dll
codious
  • 3,377
  • 6
  • 25
  • 46

0 Answers0