double Pst:: pstt(ECString& shU, int t, int word_num) { char temp[1024]; ECString sh(langAwareToLower(shU.c_str(), temp)); const Term* tTerm = Term::fromInt(t); double phst = pHst(sh, t); double ans; if(phst > 0) ans = psktt(shU, t, word_num); else ans = psutt(shU, t, word_num); return ans; }
double Pst:: pstt(ECString& shU, int t, int word_num) { char temp[MAXWORDLENGTH]; ECString sh(toLower(shU.c_str(), temp, MAXWORDLENGTH)); const Term* tTerm = Term::fromInt(t); double phst = pHst(sh, t); double ans; if(phst > 0) ans = psktt(shU, t, word_num); else ans = psutt(shU, t, word_num); return ans; }
list<double> Pst:: wordPlistConstruct(const ECString& head, int word_num) { list<double> ans; char temp[1024]; ECString headL(langAwareToLower(head.c_str(), temp)); const WordInfo* wi = useHeadC( headL ); if( wi ) { int sz = wi->stSize(); for( int i = 0 ; i < sz ; i ++ ) { Phsgt& wti = wi->st_[i]; int tInt = wti.term; if(tInt > Term::lastTagInt()) continue; double prob = psktt(head,tInt,word_num); ans.push_back(tInt); ans.push_back(prob); if(prob == 0) cerr << "Warning, prob = 0 for word = " << head << " and pos = " << tInt << endl; //cerr << "wordPlist: " << word << "\t" << tInt // << "\t" << prob << endl; } } else { for(int i = 0 ; i <= Term::lastTagInt() ; i++) { double phut = pHugt(i); if(phut == 0) continue; double prob = psutt(head,i,word_num); ans.push_back(i); ans.push_back(prob); } } return ans; }