필터 지우기
필터 지우기

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

채택된 답변

Jeff Miller
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개)

카테고리

Help CenterFile Exchange에서 Text Files에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by