This commit is contained in:
2018-09-18 23:34:45 +00:00
parent 5c94811ac6
commit b45095a350

View File

@@ -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
@@ -419,16 +431,7 @@ namespace AyaNova.Biz
#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