public SentenceLearner(WordVectors vectors, Sentences sentences, ContextMaps contextMaps) { _vectors = vectors; _sentences = sentences; _network = NeuralNetworkFactory.CreateNeuralNetwork( WordVector.VectorLength + MorphoSyntacticContext.VectorLength, MorphoSyntacticContext.VectorLength, WordVector.VectorLength); _contextMaps = contextMaps; MinError = 0.01; }
public WordVectorLoader(string filename) { if (!File.Exists(filename)) throw new FileNotFoundException(String.Format("{0} not found", filename)); _vectorFileReader = File.OpenText(filename); var readLine = _vectorFileReader.ReadLine(); if (readLine == null) { throw new InvalidDataException("Missing header line"); } if (readLine.StartsWith("Copy this file from")) { throw new InvalidDataException("The file wikipedia_vectors.txt needs to be replaced. " + readLine); } var headerFields = readLine.Split(' '); _numEntries = int.Parse(headerFields[0]); _numDimensions = int.Parse(headerFields[1]); WordVectors = new WordVectors(_numEntries); }
public static ITrainingAction ImplementPlan(IPlan plan, WordVectors vectors, ContextMaps maps) { _vectors = vectors; var action = new RootTrainingAction(plan, maps); return action; }