private void extractPhrasesToolStripMenuItem_Click(object sender, EventArgs e) { string requestId; CandidatesPhrases candidateSettings = new CandidatesPhrases(); if (candidateSettings.ShowDialog() == System.Windows.Forms.DialogResult.OK) { int count = int.Parse(candidateSettings.TextBoxCandidateCount.Text); int mnNGramFq = int.Parse(candidateSettings.TextBoxMnFq.Text); CustomQuery query = new CustomQuery(new QNGramsParam() { MnNGramFq = mnNGramFq, MnNGramLen = 2, MxNGramCount = count }); string request = Defaults.BuildRequest(PublisherName, "Query", query.ToString(), out requestId); StatusText.Text = "Computing new candidates..."; SendRequest(request, requestId, "nGram"); } }
private void extractCandidatesUsingClusteringToolStripMenuItem_Click(object sender, EventArgs e) { try { if (_computingCandidates) { ButtonGetCandidates.Text = "Please wait..."; _stopComputingCandidates = true; return; } // these items should be ignored from computing kmeans or hkmeans HashSet<int> ignoredTagsHash = new HashSet<int> { GetTagId(-1, _tagNameConcepts), GetTagId(-1, _tagNameCustomSources) }; ignoredTagsHash.Remove(TagInfoBase.InvalidTagId); QArgs args = null; if (ignoredTagsHash.Count > 0) args = new QArgs(null, new[] { new QTagIdCond(ignoredTagsHash) }); string requestId; CandidatesClusters candidateSettings = new CandidatesClusters(this); if (candidateSettings.ShowDialog() == System.Windows.Forms.DialogResult.OK) { ListViewCandidates.Items.Clear(); int count = int.Parse(candidateSettings.TextBoxCandidateCount.Text); StatusText.Text = "Computing new candidates..."; QKeywordMethod method = candidateSettings.GetConceptExtractionMethod(); if (candidateSettings.RadioTags.Checked) { StatusProgressBar.Minimum = 0; StatusProgressBar.Maximum = candidateSettings.SelectedTags.Count; _tagIdsToProcess = new Queue<int>(candidateSettings.SelectedTags); _tagIdsToProcessCount = candidateSettings.SelectedTags.Count; _keywordsForTagMethod = method.ToString(); _keywordsForTagCount = candidateSettings.GetConceptCount(); _computingCandidates = true; RequestKeywordsForNextTagId(); } else if (candidateSettings.RadioKMeans.Checked) { int k = int.Parse(candidateSettings.TextBoxKMeans.Text); CustomQuery query = new CustomQuery(new QKwdKMeansParam() { K = k, KeywordCount = count, KeywordMethod = method }, args); string request = Defaults.BuildRequest(PublisherName, "Query", query.ToString(), out requestId); SendRequest(request, requestId, "kmeans"); } else if (candidateSettings.RadioHKMeans.Checked) { int min = int.Parse(candidateSettings.TextBoxHKMeansMin.Text); int max = int.Parse(candidateSettings.TextBoxHKMeansMax.Text); CustomQuery query = new CustomQuery(new QKwdHKMeansParam() { MnDocsPerCluster = min, MxDocsPerCluster = max, KeywordCount = count, KeywordMethod = method }, args); string request = Defaults.BuildRequest(PublisherName, "Query", query.ToString(), out requestId); SendRequest(request, requestId, "hkmeans"); } } } catch (Exception ex) { MessageBox.Show("Exception while computing candidates: " + ex.Message); } }
private void extractCandidatesUsingNeutralContentMenuItem_Click(object sender, EventArgs e) { string requestId; CandidatesUsingSVM candidateSettings = new CandidatesUsingSVM(this); if (candidateSettings.ShowDialog() == System.Windows.Forms.DialogResult.OK) { int keywordCount = candidateSettings.GetConceptCount(); int timeLimit = candidateSettings.GetTimeLimit(); //string positiveExamples = "<tagIds>" + String.Join(",", candidateSettings.ProjectTags) + "</tagIds>"; //string negativeExamples = "<tagIds>" + String.Join(",", candidateSettings.NeutralTags) + "</tagIds>"; CustomQuery query = new CustomQuery(new QKwdSVMParam() { KeywordCount = keywordCount, TimeLimit = timeLimit }, new QArgs(new QTagIdCond(candidateSettings.ProjectTags)), new QArgsNegative(new QTagIdCond(candidateSettings.NeutralTags))); string request = Defaults.BuildRequest(PublisherName, "Query", query.ToString(), out requestId); StatusText.Text = "Computing new candidates..."; SendRequest(request, requestId, "keywordsUsingNeutralSources"); } }
private void ButtonAutoAddRelatedConcepts_Click(object sender, EventArgs e) { ListViewRelated.Items.Clear(); if (string.IsNullOrEmpty(TextBoxDescription.Text)) { MessageBox.Show("In order to automatically identify related concepts you first have to provide the concept description.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (GetTag(-1, _tagNameConcepts) == null) { MessageBox.Show("The tag for the Annotation ontology concepts was not identified. Unable to automatically suggest related concepts.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } string requestId = ""; CustomQuery query = new CustomQuery(new QSimilarItemsParam() { TextToCompare = TextBoxDescription.Text, MaxCount = 10 }, new QArgs(new QTagIdCond(GetTag(-1, _tagNameConcepts).TagId))); string request = Defaults.BuildRequest(PublisherName, "GetSimilarConcepts", query.ToString(), out requestId); SendRequest(request, requestId, "GetSimilarConcepts"); }