MLWordEmbedding

Question 1: I'm trying to follow along with the code from WWDC20-10657 , but my Xcode won't recognise MLWordEmbedding . I am importing Natural Language, CoreML and CreateML

Question 2: More generally - I have not grasped how an .mlmodel (which I built in Playgrounds from my domain specific text corpus) can be easily converted into a custom sentence embedding.

Right now I have 'something' that I can use in that I brute force unpacked the .mlmodel into [key: [vector]] dictionary, which I am now trying the reformat as a custom embedding - but the video implied that the .mlmodel could be used more or less directly.

In the same vein - the sample code uses the line

`self.cosineDistance(vector, queryVector)'

which doesn't correlate to anything that intellisence offers.

I am able to determine the distance between two strings directly with ' embedding.distance(between: string1, and: string2)' - but this is inefficient because I am ending up repeatedly recalculating the vectors for the sentence embeddings for the text corpus.

MLWordEmbedding
 
 
Q