How to load the letter and their log probabilities in database.txt into our program?
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Jeff Miller
2020-4-4
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 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Text Files 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!