This commit is contained in:
@@ -20,7 +20,7 @@ namespace AyaNova.Biz
|
||||
//WordBreaker - break down into words
|
||||
//ProcessKeywords into database
|
||||
|
||||
|
||||
#region ProcessKeywords into Database
|
||||
/// <summary>
|
||||
/// Process the keywords into the dictionary
|
||||
/// </summary>
|
||||
@@ -58,12 +58,29 @@ namespace AyaNova.Biz
|
||||
// ct.SaveChanges();
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
|
||||
#region Breaker
|
||||
|
||||
//Class to hold relevant locale data for breaking text
|
||||
public class LocaleWordBreakingData
|
||||
{
|
||||
public bool CJKIndex { get; set; }
|
||||
public List<string> StopWords { get; set; }
|
||||
public LocaleWordBreakingData()
|
||||
{
|
||||
CJKIndex = false;
|
||||
StopWords = new List<string>();
|
||||
}
|
||||
}
|
||||
|
||||
//Get the current stopwords for the user's locale
|
||||
private static LocaleSearchData GetLocaleSearchData(long localeId, AyContext ct = null)
|
||||
private static LocaleWordBreakingData GetLocaleSearchData(long localeId, AyContext ct = null)
|
||||
{
|
||||
LocaleSearchData LSD = new LocaleSearchData();
|
||||
LocaleWordBreakingData LSD = new LocaleWordBreakingData();
|
||||
if (ct == null)
|
||||
ct = ServiceProviderProvider.DBContext;
|
||||
//Get stopwords
|
||||
@@ -92,11 +109,6 @@ namespace AyaNova.Biz
|
||||
return LSD;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#region Breaker
|
||||
|
||||
public enum TokenTypes
|
||||
{ Nothing, Separator, CJK, Latin };
|
||||
|
||||
@@ -140,7 +152,7 @@ namespace AyaNova.Biz
|
||||
internal static string BreakCore(long localeId, bool KeepWildCards, params string[] text)
|
||||
{
|
||||
//Get stopwords and CJKIndex flag value
|
||||
LocaleSearchData LSD = GetLocaleSearchData(localeId);
|
||||
LocaleWordBreakingData LSD = GetLocaleSearchData(localeId);
|
||||
int MAXWORDLENGTH = 255;
|
||||
StringBuilder sbResults = new StringBuilder();
|
||||
//List to temporarily hold parsed words
|
||||
@@ -397,38 +409,29 @@ namespace AyaNova.Biz
|
||||
//bail early if there is nothing indexed
|
||||
if (tempParsedWords.Count == 0) return "";
|
||||
|
||||
|
||||
//Make a return string array
|
||||
//from the word list
|
||||
foreach (string s in tempParsedWords)
|
||||
{
|
||||
//Add only non stopwords
|
||||
if (!StopList.Contains(s))
|
||||
{
|
||||
sbResults.Append(s);
|
||||
sbResults.Append(",");
|
||||
}
|
||||
}
|
||||
|
||||
//sometimes all the results are stop words so you end up
|
||||
//here with nothing in sbResults.
|
||||
return sbResults.ToString().TrimEnd(',');
|
||||
//Make a return string array
|
||||
//from the word list
|
||||
foreach (string s in tempParsedWords)
|
||||
{
|
||||
//Add only non stopwords
|
||||
if (!StopList.Contains(s))
|
||||
{
|
||||
sbResults.Append(s);
|
||||
sbResults.Append(",");
|
||||
}
|
||||
}
|
||||
|
||||
//sometimes all the results are stop words so you end up
|
||||
//here with nothing in sbResults.
|
||||
return sbResults.ToString().TrimEnd(',');
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
public class LocaleSearchData
|
||||
{
|
||||
public bool CJKIndex { get; set; }
|
||||
public List<string> StopWords { get; set; }
|
||||
public LocaleSearchData()
|
||||
{
|
||||
CJKIndex = false;
|
||||
StopWords = new List<string>();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}//eoc
|
||||
|
||||
Reference in New Issue
Block a user