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