Recurrent neural Network Language Modeling Toolkit Code Learning

Source: Internet
Author: User

Recurrent neural Network Language Modeling Toolkit tool use Click to open link


Follow the training schedule to learn the code:

Structure in Trainnet ():

Step1.

learnvocabfromtrainfile () Statistics all the word information in the training file, and organize the statistic good information

The data structures involved:

Vocab_word

Ocab_hash *int

The functions involved:

Addwordtovocab ()

For a word w, the information is stored in an array of vocab_word structure, its structure is labeled WP, and then take the hash code of W (Getwordhash ), so that the value of the hash code in the Vocab_ The subscript WP in the word structure. [Vocab_word is then sort, the subscript of the word w may change , this will be reflected in the Searchvocab]

Searchvocab ()

Finds and returns the subscript of the word w in Vocab_word. Take its hash code, find in Vocab_hash, if not check out then return-1, otherwise find the subscript, take out the vocab in the subscript corresponding word with the word w to compare, if the same, then return the subscript, otherwise in vocab to find the contrast, the The index found is added and returned in Vocab_has, or 1 if it is still not found.

Sortvocab ()

Reorder the Vocab_word based on the number of occurrences of the word in the training set.




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.