public static Resultados bestMatch(string[] consulta, string[] PalabraIndice, int[,] DocIndice) { Resultados Result = new Resultados(); for (int i = 0; i < consulta.Length; i++) { for (int j = 0; j < PalabraIndice.Length; j++) { if (consulta[i] == PalabraIndice[j]) { for (int k = 0; k < Documentos.TotalDocumentos; k++) { Result.Result[k] = DocIndice[j, k] + Result.Result[k]; } } } } int l = 0; for (int i = 0; i < Result.Result.Length; i++) { if (Result.Result[i] == 0) { l++; if (l == Result.Result.Length) { return(null); } } } return(Result); }
public static void ConsultarE(object Frase) { string frase = Frase.ToString(); string[] SW = new string[StopWords.TotalPalabras]; SW = StopWords.Palabras; string[] Palabras = LimpiarPalabras(frase, SW); Resultados ResultDoc = new Resultados(); ResultDoc = exactMatch(Palabras, Indice.PalabrasIndice, Indice.DocsIndice); lock (Block) { if (ResultDoc != null) { Array.Resize(ref Result, i + 1); Result[i] = ResultDoc; Result[i].Phrase = frase; EventResult(Result[i]); i++; } } }