Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Tuesday, September 8, 2009 11:06:34 PM(UTC)
borgb002

Groups: Registered
Posts: 2


Hi, I'm using the below code and when the compiler reaches the line: "userDictionary.Create(defaultSectionName)" it pops out the error "section name not supported"

any ideas what this might be please?





'=====================================================
Try
      RasterSupport.Unlock(RasterSupportType.Document, "123")
      RasterSupport.Unlock(RasterSupportType.OcrAdvantage, "123")



      ' Create an instance of the engine
      Using ocrEngine As IOcrEngine = OcrEngineManager.CreateEngine(OcrEngineType.Advantage, False)
        ' Start the engine using default parameters
        ocrEngine.Startup(Nothing, Nothing, Nothing, Nothing)

        ' Get the user dictionary object used in the engine
        Dim userDictionary As IOcrUserDictionary = ocrEngine.SpellCheckManager.UserDictionary

        ' Create a new user dictionary
        Dim defaultSectionName As String = "Cities"
        userDictionary.Create(defaultSectionName)


        ' Add a few items to this user dictionary
        Dim cities() As String = {"Lagos, Amman"}
        For Each city As String In cities
          Dim item As IOcrUserDictionaryItem = userDictionary.CreateItem(city, OcrUserDictionaryItemStyles.None)
          userDictionary.AddItem(defaultSectionName, item)
        Next

        ' Save this user dictionary to disk
        Dim userDictionaryFileName As String = "C:\Cities.ud"
        userDictionary.Save(userDictionaryFileName)
        userDictionary.Close()

        ' Now re-open this user dictionary to show how we can iterate the items
        userDictionary.Open(userDictionaryFileName, defaultSectionName)

        ' Enumerate the sections
        Dim sectionName As String = userDictionary.GetFirstSectionName()
        Do While (Not sectionName Is Nothing)
          Console.WriteLine("Section: {0}", sectionName)

          ' Find the items of this section
          ' Note, the items returned maight be a group of the items you added
          Dim item As IOcrUserDictionaryItem = userDictionary.GetFirstItem(sectionName)
          Do While (Not item Is Nothing)
            Console.WriteLine(" Item: {0}", item.Value)
            item = userDictionary.GetNextItem()
          Loop

          sectionName = userDictionary.GetNextSectionName()
        Loop

        userDictionary.Close()

        ' Now set this user dictionary as the one to use in spell checking
        userDictionary.Use(userDictionaryFileName, defaultSectionName)

        ' Show the current user dictionary and section names
        Console.WriteLine("User dictionary in use:\nFileName: {0}\nDefaultSectionName: {1}", userDictionary.FileName, userDictionary.DefaultSectionName)

        ' Shutdown the engine
        ' Note: calling Dispose will also automatically shutdown the engine if it has been started
        ocrEngine.Shutdown()
      End Using

    Catch ex As Exception
      MessageBox.Show(ex.Message)
    End Try
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Wednesday, September 9, 2009 3:33:00 AM(UTC)

Adnan Ismail  
Guest

Groups: Guests
Posts: 3,022

Was thanked: 2 time(s) in 2 post(s)

I noticed that you are using the LEADTOOLS OCR Advantage engine. Please note that User dictionary sections are not supported in in this engine and they are only supported in the OCR Plus and OCR Professional engines.
 
#3 Posted : Wednesday, September 9, 2009 3:36:25 AM(UTC)
borgb002

Groups: Registered
Posts: 2


Is there a way in the Advantage version that I could build my own custom dictionary? Or is totally out of the question then?

 
#4 Posted : Thursday, September 10, 2009 5:41:08 AM(UTC)

Adnan Ismail  
Guest

Groups: Guests
Posts: 3,022

Was thanked: 2 time(s) in 2 post(s)

The Advantage OCR engine has a user dictionary support in it. However, it does not have a Sections feature. This means that you can add your own words to the dictionary, and the engine will automatically use them during recognition.

The English dictionary file is called Advantage.en.Dictionary.bin

 
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.085 seconds.