anchor.diff:  open NFastText.FastTextM
   open System.IO
   open NFastText.Dictionary
  -let streamToWords (s:Stream) =
  +let streamToWords showLineEndings (s:Stream) =
           let r = new StreamReader(s)
           let splitters = [|' '; '\t'; '\n'; '\v'; '\f'; '\r'|]
           let word = ResizeArray<char>()
  -        let buffer = Array.zeroCreate 100000
  +        let buffer = Array.zeroCreate 1000000
           let mutable readedChars = buffer.Length
           seq{
               while readedChars = buffer.Length do
  
positive.code:                     then if word.Count > 0 
                              then yield System.String.Join("", word)
                                   word.Clear()
                      else word.Add(char)
              if word.Count > 0 then yield System.String.Join("", word)
          }
  
  let split length (xs: 'T[]) =
      let rec loop (xs: 'T[]) =
          seq{
              if xs.Length <= length 
              then yield xs
              else yield xs.[..length-1]
                   yield! loop xs.[length..]
          }
      loop xs
  
  let MAX_LINE_SIZE = 1024
  let rec streamToLines model (s:Stream) fromStartOnEof = 
      let r = new StreamReader(s)
      let rec loop() =
          let max_line_size = if model <> Args.model_name.sup
                              then MAX_LINE_SIZE
                              else System.Int32.MaxValue
          seq{
                  let mutable line = r.ReadLine()
                  while line <> null do
                      let lnWords = line.Split([|' '; '\t'; '\n'; '\v'; '\f'; '\r'|])
                      for chunk in split max_line_size lnWords do
                          yield chunk 
                      line <- r.ReadLine()
  
                  if fromStartOnEof 
                  then s.Position <- 0L
                       yield! loop()
                  }
      loop()
  
  let getTextVectors modelPath dataPath label verbose =
  
negative.code:     let state = FastTextM.loadState(modelPath,label,verbose)
      let stream = System.IO.File.Open(dataPath, FileMode.Open, FileAccess.Read, FileShare.Read)
      assert(state.args_.model <> Args.model_name.sup)
      let words = streamToWords false stream
      let vectors = words |> Seq.map (NFastText.FastTextM.getVector state)
      let r = Seq.head vectors
      assert(r.Length = state.args_.dim)
  
  let train trainDataPath modelPath threads args label verbose =
      let stream = System.IO.File.Open(trainDataPath, FileMode.Open, FileAccess.Read, FileShare.Read)
      let words = streamToWords false stream
      let dict = Dictionary(args, label, verbose)
      dict.readFromFile(words)
      let state = FastTextM.createState args dict
  