Skip to content

Commit

Permalink
Added JavaTrieNodeCounts.
Browse files Browse the repository at this point in the history
  • Loading branch information
antononcube committed Jan 9, 2017
1 parent 173da1c commit d555950
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions JavaTriesWithFrequencies.m
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ Mathematica is (C) Copyright 1988-2017 Wolfram Research, Inc.

JavaTrieMerge::usage = "Merges two Java tries."

JavaTrieNodeCounts::usage = "Returns the node counts in trie (total, internal, leaves.)"

JavaTrieNodeProbabilities::usage = "Gives the corresponding Java trie with node frequencies converted\
to probabilities."

Expand Down Expand Up @@ -202,6 +204,10 @@ Mathematica is (C) Copyright 1988-2017 Wolfram Research, Inc.
TrieFunctions`merge[jTr, jTr2]
];

Clear[JavaTrieNodeCounts]
JavaTrieNodeCounts[jTr_?JavaObjectQ] :=
AssociationThread[{"total","internal","leaves"}->JLink`JavaObjectToExpression[TrieFunctions`nodeCounts[jTr]]];

Clear[JavaTrieNodeProbabilities]
JavaTrieNodeProbabilities[jTr_?JavaObjectQ] :=
TrieFunctions`nodeProbabilities[jTr];
Expand Down

0 comments on commit d555950

Please sign in to comment.