positive force keyword 추가
This commit is contained in:
14
NewsForm.cs
14
NewsForm.cs
@@ -232,6 +232,20 @@ namespace NewsCrawler
|
|||||||
Util.Log(Util.LOG_TYPE.NEGATIVE, string.Format("[{0}] {1} (keyword:{2}, code:{3})", NewsItem.m_strRef, NewsItem.m_strTitle, MatchResult.m_strKeyword, NewsItem.m_Code.ToString()));
|
Util.Log(Util.LOG_TYPE.NEGATIVE, string.Format("[{0}] {1} (keyword:{2}, code:{3})", NewsItem.m_strRef, NewsItem.m_strTitle, MatchResult.m_strKeyword, NewsItem.m_Code.ToString()));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case TextCondition.TYPE.POSITIVE_FORCE:
|
||||||
|
if ((NewsItem.m_Code.m_enType & CodeList.CODE_TYPE.DUPLICATED) == CodeList.CODE_TYPE.DUPLICATED)
|
||||||
|
{
|
||||||
|
Util.Log(Util.LOG_TYPE.DUPLICATED, string.Format("[{0}] {1} (keyword:{2}, code:{3})", NewsItem.m_strRef, NewsItem.m_strTitle, MatchResult.m_strKeyword, NewsItem.m_Code.ToString()));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BuyItem(NewsItem.m_Code);
|
||||||
|
Util.Log(Util.LOG_TYPE.POSITIVE_FORCE, string.Format("[{0}] {1} (keyword:{2}, code:{3})", NewsItem.m_strRef, NewsItem.m_strTitle, MatchResult.m_strKeyword, NewsItem.m_Code.ToString()));
|
||||||
|
}
|
||||||
|
|
||||||
|
m_CodeList.AddDuplicatedList(NewsItem.m_Code.m_strCode, NewsItem.m_Code.m_strName);
|
||||||
|
break;
|
||||||
|
|
||||||
case TextCondition.TYPE.POSITIVE:
|
case TextCondition.TYPE.POSITIVE:
|
||||||
if((NewsItem.m_Code.m_enType&CodeList.CODE_TYPE.DENIAL) == CodeList.CODE_TYPE.DENIAL)
|
if((NewsItem.m_Code.m_enType&CodeList.CODE_TYPE.DENIAL) == CodeList.CODE_TYPE.DENIAL)
|
||||||
Util.Log(Util.LOG_TYPE.DENIAL, string.Format("[{0}] {1} (keyword:{2}, code:{3})", NewsItem.m_strRef, NewsItem.m_strTitle, MatchResult.m_strKeyword, NewsItem.m_Code.ToString()));
|
Util.Log(Util.LOG_TYPE.DENIAL, string.Format("[{0}] {1} (keyword:{2}, code:{3})", NewsItem.m_strRef, NewsItem.m_strTitle, MatchResult.m_strKeyword, NewsItem.m_Code.ToString()));
|
||||||
|
|||||||
@@ -13,10 +13,12 @@ namespace NewsCrawler
|
|||||||
NOT_MATCHED,
|
NOT_MATCHED,
|
||||||
NEGATIVE,
|
NEGATIVE,
|
||||||
POSITIVE,
|
POSITIVE,
|
||||||
|
POSITIVE_FORCE,
|
||||||
MANUAL
|
MANUAL
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Regex> m_Positive = new List<Regex>();
|
List<Regex> m_Positive = new List<Regex>();
|
||||||
|
List<Regex> m_PositiveForce = new List<Regex>();
|
||||||
List<Regex> m_Negative = new List<Regex>();
|
List<Regex> m_Negative = new List<Regex>();
|
||||||
List<Regex> m_Manual = new List<Regex>();
|
List<Regex> m_Manual = new List<Regex>();
|
||||||
List<Regex> m_Duplicated = new List<Regex>();
|
List<Regex> m_Duplicated = new List<Regex>();
|
||||||
@@ -81,6 +83,31 @@ namespace NewsCrawler
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void LoadPositiveForce()
|
||||||
|
{
|
||||||
|
m_PositiveForce.Clear();
|
||||||
|
|
||||||
|
string strPath = Util.GetConfigPath() + "/keyword-positive-force.txt";
|
||||||
|
if (File.Exists(strPath) == true)
|
||||||
|
{
|
||||||
|
string[] aLines = File.ReadAllLines(strPath);
|
||||||
|
foreach (string line in aLines)
|
||||||
|
{
|
||||||
|
if (line.Trim().Length == 0 || line[0] == '#')
|
||||||
|
continue;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
m_PositiveForce.Add(new Regex(line));
|
||||||
|
}
|
||||||
|
catch (ArgumentException ex)
|
||||||
|
{
|
||||||
|
Util.Log(Util.LOG_TYPE.ERROR, string.Format("[keyword-positive-force] 잘못된 키워드 ({0})", ex.Message));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void LoadManual()
|
public void LoadManual()
|
||||||
{
|
{
|
||||||
m_Manual.Clear();
|
m_Manual.Clear();
|
||||||
@@ -160,6 +187,7 @@ namespace NewsCrawler
|
|||||||
void LoadAll()
|
void LoadAll()
|
||||||
{
|
{
|
||||||
LoadPositive();
|
LoadPositive();
|
||||||
|
LoadPositiveForce();
|
||||||
LoadNegative();
|
LoadNegative();
|
||||||
LoadManual();
|
LoadManual();
|
||||||
LoadDuplicatedKeyword();
|
LoadDuplicatedKeyword();
|
||||||
@@ -167,7 +195,11 @@ namespace NewsCrawler
|
|||||||
|
|
||||||
public string GetKeywordsCnt()
|
public string GetKeywordsCnt()
|
||||||
{
|
{
|
||||||
return string.Format("Positive : {0}\nNegative : {1}\nManual : {2}", m_Positive.Count, m_Negative.Count, m_Manual.Count);
|
return string.Format("Positive: {0}\nPositiveForce: {1}\nNegative: {2}\nManual: {3}",
|
||||||
|
m_Positive.Count,
|
||||||
|
m_PositiveForce.Count,
|
||||||
|
m_Negative.Count,
|
||||||
|
m_Manual.Count);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class RESULT
|
public class RESULT
|
||||||
@@ -201,6 +233,10 @@ namespace NewsCrawler
|
|||||||
if(result != null)
|
if(result != null)
|
||||||
return new RESULT(TYPE.POSITIVE, result.ToString());
|
return new RESULT(TYPE.POSITIVE, result.ToString());
|
||||||
|
|
||||||
|
result = m_PositiveForce.Find(s => s.IsMatch(strText));
|
||||||
|
if (result != null)
|
||||||
|
return new RESULT(TYPE.POSITIVE_FORCE, result.ToString());
|
||||||
|
|
||||||
return new RESULT(TYPE.NOT_MATCHED, "");
|
return new RESULT(TYPE.NOT_MATCHED, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
2
Util.cs
2
Util.cs
@@ -19,6 +19,7 @@ namespace NewsCrawler
|
|||||||
VERVOSE,
|
VERVOSE,
|
||||||
NEGATIVE,
|
NEGATIVE,
|
||||||
POSITIVE,
|
POSITIVE,
|
||||||
|
POSITIVE_FORCE,
|
||||||
MANUAL_KEYWORD,
|
MANUAL_KEYWORD,
|
||||||
MANUAL_CODE,
|
MANUAL_CODE,
|
||||||
DUPLICATED,
|
DUPLICATED,
|
||||||
@@ -68,6 +69,7 @@ namespace NewsCrawler
|
|||||||
LogColor = Color.Blue;
|
LogColor = Color.Blue;
|
||||||
break;
|
break;
|
||||||
case LOG_TYPE.POSITIVE:
|
case LOG_TYPE.POSITIVE:
|
||||||
|
case LOG_TYPE.POSITIVE_FORCE:
|
||||||
case LOG_TYPE.MANUAL_KEYWORD:
|
case LOG_TYPE.MANUAL_KEYWORD:
|
||||||
case LOG_TYPE.BUY:
|
case LOG_TYPE.BUY:
|
||||||
LogColor = Color.Red;
|
LogColor = Color.Red;
|
||||||
|
|||||||
1
configure/keyword-positive-force.txt
Normal file
1
configure/keyword-positive-force.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
무조건
|
||||||
Reference in New Issue
Block a user