diff --git a/IME WL Converter/IME WL Converter/Forms/WordRankGenerateForm.Designer.cs b/IME WL Converter/IME WL Converter/Forms/WordRankGenerateForm.Designer.cs
index 9a988cf6..32d2137a 100644
--- a/IME WL Converter/IME WL Converter/Forms/WordRankGenerateForm.Designer.cs
+++ b/IME WL Converter/IME WL Converter/Forms/WordRankGenerateForm.Designer.cs
@@ -34,15 +34,16 @@ private void InitializeComponent()
this.rbtnDefault = new System.Windows.Forms.RadioButton();
this.numRank = new System.Windows.Forms.NumericUpDown();
this.btnOK = new System.Windows.Forms.Button();
+ this.cbxForceUseNewRank = new System.Windows.Forms.CheckBox();
((System.ComponentModel.ISupportInitialize)(this.numRank)).BeginInit();
this.SuspendLayout();
//
// rbtnGoogle
//
this.rbtnGoogle.AutoSize = true;
- this.rbtnGoogle.Location = new System.Drawing.Point(35, 31);
+ this.rbtnGoogle.Location = new System.Drawing.Point(35, 29);
this.rbtnGoogle.Name = "rbtnGoogle";
- this.rbtnGoogle.Size = new System.Drawing.Size(185, 17);
+ this.rbtnGoogle.Size = new System.Drawing.Size(191, 16);
this.rbtnGoogle.TabIndex = 0;
this.rbtnGoogle.TabStop = true;
this.rbtnGoogle.Text = "Google搜索(访问网络,速度慢)";
@@ -51,9 +52,9 @@ private void InitializeComponent()
// rbtnBaidu
//
this.rbtnBaidu.AutoSize = true;
- this.rbtnBaidu.Location = new System.Drawing.Point(35, 82);
+ this.rbtnBaidu.Location = new System.Drawing.Point(35, 76);
this.rbtnBaidu.Name = "rbtnBaidu";
- this.rbtnBaidu.Size = new System.Drawing.Size(175, 17);
+ this.rbtnBaidu.Size = new System.Drawing.Size(179, 16);
this.rbtnBaidu.TabIndex = 1;
this.rbtnBaidu.TabStop = true;
this.rbtnBaidu.Text = "百度搜索(访问网络,速度慢)";
@@ -62,9 +63,9 @@ private void InitializeComponent()
// rbtnCalc
//
this.rbtnCalc.AutoSize = true;
- this.rbtnCalc.Location = new System.Drawing.Point(35, 131);
+ this.rbtnCalc.Location = new System.Drawing.Point(35, 121);
this.rbtnCalc.Name = "rbtnCalc";
- this.rbtnCalc.Size = new System.Drawing.Size(127, 17);
+ this.rbtnCalc.Size = new System.Drawing.Size(131, 16);
this.rbtnCalc.TabIndex = 2;
this.rbtnCalc.TabStop = true;
this.rbtnCalc.Text = "按字频计算(速度快)";
@@ -73,9 +74,9 @@ private void InitializeComponent()
// rbtnDefault
//
this.rbtnDefault.AutoSize = true;
- this.rbtnDefault.Location = new System.Drawing.Point(35, 182);
+ this.rbtnDefault.Location = new System.Drawing.Point(35, 168);
this.rbtnDefault.Name = "rbtnDefault";
- this.rbtnDefault.Size = new System.Drawing.Size(73, 17);
+ this.rbtnDefault.Size = new System.Drawing.Size(71, 16);
this.rbtnDefault.TabIndex = 3;
this.rbtnDefault.TabStop = true;
this.rbtnDefault.Text = "默认值:";
@@ -83,9 +84,9 @@ private void InitializeComponent()
//
// numRank
//
- this.numRank.Location = new System.Drawing.Point(112, 182);
+ this.numRank.Location = new System.Drawing.Point(112, 168);
this.numRank.Name = "numRank";
- this.numRank.Size = new System.Drawing.Size(66, 20);
+ this.numRank.Size = new System.Drawing.Size(66, 21);
this.numRank.TabIndex = 4;
this.numRank.Value = new decimal(new int[] {
1,
@@ -95,19 +96,30 @@ private void InitializeComponent()
//
// btnOK
//
- this.btnOK.Location = new System.Drawing.Point(188, 231);
+ this.btnOK.Location = new System.Drawing.Point(188, 213);
this.btnOK.Name = "btnOK";
- this.btnOK.Size = new System.Drawing.Size(75, 25);
+ this.btnOK.Size = new System.Drawing.Size(75, 23);
this.btnOK.TabIndex = 5;
this.btnOK.Text = "确 定";
this.btnOK.UseVisualStyleBackColor = true;
this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
//
+ // cbxForceUseNewRank
+ //
+ this.cbxForceUseNewRank.AutoSize = true;
+ this.cbxForceUseNewRank.Location = new System.Drawing.Point(35, 217);
+ this.cbxForceUseNewRank.Name = "cbxForceUseNewRank";
+ this.cbxForceUseNewRank.Size = new System.Drawing.Size(108, 16);
+ this.cbxForceUseNewRank.TabIndex = 6;
+ this.cbxForceUseNewRank.Text = "强制使用新词频";
+ this.cbxForceUseNewRank.UseVisualStyleBackColor = true;
+ //
// WordRankGenerateForm
//
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(284, 284);
+ this.ClientSize = new System.Drawing.Size(284, 262);
+ this.Controls.Add(this.cbxForceUseNewRank);
this.Controls.Add(this.btnOK);
this.Controls.Add(this.numRank);
this.Controls.Add(this.rbtnDefault);
@@ -133,5 +145,6 @@ private void InitializeComponent()
private System.Windows.Forms.RadioButton rbtnDefault;
private System.Windows.Forms.NumericUpDown numRank;
private System.Windows.Forms.Button btnOK;
+ private System.Windows.Forms.CheckBox cbxForceUseNewRank;
}
}
\ No newline at end of file
diff --git a/IME WL Converter/IME WL Converter/Forms/WordRankGenerateForm.cs b/IME WL Converter/IME WL Converter/Forms/WordRankGenerateForm.cs
index 2d1c1fa6..1bafcc71 100644
--- a/IME WL Converter/IME WL Converter/Forms/WordRankGenerateForm.cs
+++ b/IME WL Converter/IME WL Converter/Forms/WordRankGenerateForm.cs
@@ -36,6 +36,7 @@ private void btnOK_Click(object sender, EventArgs e)
{
wordRankGenerater = new CalcWordRankGenerater();
}
+ wordRankGenerater.ForceUse = cbxForceUseNewRank.Checked;
DialogResult = DialogResult.OK;
}
@@ -53,6 +54,7 @@ private void WordRankGenerateForm_Load(object sender, EventArgs e)
{
rbtnBaidu.Checked = true;
}
+ cbxForceUseNewRank.Checked = wordRankGenerater.ForceUse;
}
}
}
\ No newline at end of file
diff --git a/IME WL Converter/IME WL Converter/Forms/WordRankGenerateForm.resx b/IME WL Converter/IME WL Converter/Forms/WordRankGenerateForm.resx
index 7080a7d1..1af7de15 100644
--- a/IME WL Converter/IME WL Converter/Forms/WordRankGenerateForm.resx
+++ b/IME WL Converter/IME WL Converter/Forms/WordRankGenerateForm.resx
@@ -112,9 +112,9 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
\ No newline at end of file
diff --git a/IME WL Converter/IME WL Converter/Generaters/BaiduWordRankGenerater.cs b/IME WL Converter/IME WL Converter/Generaters/BaiduWordRankGenerater.cs
index 4d01e8a4..4c013019 100644
--- a/IME WL Converter/IME WL Converter/Generaters/BaiduWordRankGenerater.cs
+++ b/IME WL Converter/IME WL Converter/Generaters/BaiduWordRankGenerater.cs
@@ -9,7 +9,7 @@ public class BaiduWordRankGenerater : IWordRankGenerater
{
private static string API = "http://www.baidu.com/s?wd={0}";
private static readonly Regex regex = new Regex("百度为您找到相关结果约([0-9\\,]+)个");
-
+ public bool ForceUse { get; set; }
public int GetRank(string word)
{
try
diff --git a/IME WL Converter/IME WL Converter/Generaters/CalcWordRankGenerater.cs b/IME WL Converter/IME WL Converter/Generaters/CalcWordRankGenerater.cs
index dedd1de1..d287224b 100644
--- a/IME WL Converter/IME WL Converter/Generaters/CalcWordRankGenerater.cs
+++ b/IME WL Converter/IME WL Converter/Generaters/CalcWordRankGenerater.cs
@@ -4,6 +4,7 @@ namespace Studyzy.IMEWLConverter.Generaters
{
public class CalcWordRankGenerater : IWordRankGenerater
{
+ public bool ForceUse { get; set; }
public int GetRank(string word)
{
double x = 1;
diff --git a/IME WL Converter/IME WL Converter/Generaters/DefaultWordRankGenerater.cs b/IME WL Converter/IME WL Converter/Generaters/DefaultWordRankGenerater.cs
index 6a0ea284..0a04a833 100644
--- a/IME WL Converter/IME WL Converter/Generaters/DefaultWordRankGenerater.cs
+++ b/IME WL Converter/IME WL Converter/Generaters/DefaultWordRankGenerater.cs
@@ -6,7 +6,7 @@ public DefaultWordRankGenerater()
{
Rank = 1;
}
-
+ public bool ForceUse { get; set; }
public int Rank { get; set; }
public int GetRank(string word)
diff --git a/IME WL Converter/IME WL Converter/Generaters/GoogleWordRankGenerater.cs b/IME WL Converter/IME WL Converter/Generaters/GoogleWordRankGenerater.cs
index f3ede6bb..0d953816 100644
--- a/IME WL Converter/IME WL Converter/Generaters/GoogleWordRankGenerater.cs
+++ b/IME WL Converter/IME WL Converter/Generaters/GoogleWordRankGenerater.cs
@@ -9,7 +9,7 @@ public class GoogleWordRankGenerater : IWordRankGenerater
{
private static string API = "https://www.google.com/search?q={0}";
private static readonly Regex regex = new Regex("estimatedResultCount: \"(\\d+)\"");
-
+ public bool ForceUse { get; set; }
public int GetRank(string word)
{
try
diff --git a/IME WL Converter/IME WL Converter/Generaters/IWordRankGenerater.cs b/IME WL Converter/IME WL Converter/Generaters/IWordRankGenerater.cs
index 99f553db..593ea104 100644
--- a/IME WL Converter/IME WL Converter/Generaters/IWordRankGenerater.cs
+++ b/IME WL Converter/IME WL Converter/Generaters/IWordRankGenerater.cs
@@ -3,5 +3,9 @@
public interface IWordRankGenerater
{
int GetRank(string word);
+ ///
+ /// 是否忽略源词库的词频,强制使用新词频?
+ ///
+ bool ForceUse { get; set; }
}
}
\ No newline at end of file
diff --git a/IME WL Converter/IME WL Converter/MainBody.cs b/IME WL Converter/IME WL Converter/MainBody.cs
index b6e4ba35..e601c768 100644
--- a/IME WL Converter/IME WL Converter/MainBody.cs
+++ b/IME WL Converter/IME WL Converter/MainBody.cs
@@ -208,7 +208,7 @@ private void GenerateWordRank(WordLibraryList wordLibraryList)
currentStatus = 0;
foreach (WordLibrary wordLibrary in wordLibraryList)
{
- if (wordLibrary.Rank == 0)
+ if (wordLibrary.Rank == 0|| wordRankGenerater.ForceUse )
{
wordLibrary.Rank = wordRankGenerater.GetRank(wordLibrary.Word);
}