How to load the letter and their log probabilities in database.txt into our program?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
whalelady
le 4 Avr 2020
Réponse apportée : Jeff Miller
le 4 Avr 2020
I have a txt file and I need to add this txt file into my program to access the unigram and bigram database.
Is there any way I could load it into the program directly without hardcoding/copy and paste?
***********************************************************
**** This table is the log_2
**** probability of letter unigrams
**** i.e., log_2(p('a letter'))
**** Note: the unigram and probability are tab delimited
***********************************************************
a -3.561879942602564
b -6.036018896964266
c -4.9663355149956425
***********************************************************
**** This table is the log_2
**** probability of letter bigrams
**** i.e., log_2(p('first letter, second letter'))
**** Note: the bigram and probability are tab delimited
***********************************************************
aa -11.077395929707704
ab -9.279102981402742
ac -7.9797285896725825
ad -8.160340354667962
ae -11.752348492976163
0 commentaires
Réponse acceptée
Jeff Miller
le 4 Avr 2020
This function on FileExchange simply returns a long list of all the numbers in the file. Since it looks like your file has the numbers in a pre-determined order with no extraneous numbers, it might do what you want.
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Database Toolbox dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!