Skip to content

Expose predicted probabilities  #52

Description

@loretoparisi

An internal function of CLD2, int GetLangScore(uint32 probs, uint8 pslang) let you get the score of a language by language probability.
This is used in several points to calculate the score of a language, given the top 3 languages predicted like here:

if (indirect < static_cast<int>(obj->kCLDTableSizeOne)) {
    // Up to three languages at indirect
    uint32 langprob = obj->kCLDTableInd[indirect];
    return GetLangScore(langprob, lang1) - GetLangScore(langprob, lang2);
  }

I would like to get the opposite, hence to get the probabilities for each language, referred in the code as langprob.

There are some internal testing function like string GetLangProbTxt(const ScoringContext* scoringcontext, uint32 langprob) that seems to print out these probabilities here, so in theory it should be easier as

uint32 langprob = base_obj->kCLDTableInd[indirect];
retval.append(GetLangProbTxt(scoringcontext, langprob));

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions