diff --git a/JavaTriesWithFrequencies.m b/JavaTriesWithFrequencies.m index bcd06884..54ed9a9e 100644 --- a/JavaTriesWithFrequencies.m +++ b/JavaTriesWithFrequencies.m @@ -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." @@ -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];