Android SDK Version

public class Utils
Field Summary
Modifier and TypeFieldDescription
public final static UtilsINSTANCE
Method Summary
Modifier and TypeMethodDescription
final IntArrayvectorize(String texts, Integer maxLen)
final StringnormalizeString(String str)
final static FilegetMlDir()
final static Map<String, MTensor>parseModelWeights(File file) Parse AppEvents model files.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Method Detail


 final IntArrayvectorize(String texts, Integer maxLen)


 final StringnormalizeString(String str)


 final static FilegetMlDir()


 final static Map<String, MTensor> parseModelWeights(File file)
Parse AppEvents model files.
The model file format is described by following parts:
  • First 4 bytes: an 32-bit integer encoded in little-endian order for the length of metadata string, denoted by L.
  • Next L bytes: a JSONObject string for the metadata. Its keys are the name of the weights and its values are the shape of the weight tensors.
  • Then there are multiple float arrays encoded with the little-endian order for all weight tensors. The arrays are ordered by the lexicographic order of keys in the metadata.
file - the model file object