forked from delosyCho/ossproject_sanghyeon
/
POS_Tagger.cs
77 lines (61 loc) · 1.86 KB
/
POS_Tagger.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
using LLCS.NLP;
using opennlp.tools.tokenize;
using opennlp.tools.postag;
using opennlp.tools.parser;
using java.io;
using java.util;
using java.text;
namespace LLCS.Forms
{
public partial class POS_Tagger : Form
{
String[] words;
SentimentalManager sm;
int[] a = new int[10];
public POS_Tagger()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
InputStream modelIn = new FileInputStream("en-pos-maxent.bin");
POSModel model = new POSModel(modelIn);
// initialize POSTaggerME
POSTaggerME tagger = new POSTaggerME(model);
words = textBox1.Text.Split();
String[] result = tagger.tag(words);
label1.Text = "";
for (int i = 0; i < result.Length; i++)
{
label1.Text += result[i] + ", ";
}
}
private void button2_Click(object sender, EventArgs e)
{
sm = new SentimentalManager();
}
private void button3_Click(object sender, EventArgs e)
{
double Score = sm.extract(textBox1.Text, "a");
label1.Text = textBox1.Text + " : " + Score;
}
private void button4_Click(object sender, EventArgs e)
{
double Score = sm.extract(textBox1.Text);
label1.Text = textBox1.Text + " : " + Score;
}
private void POS_Tagger_Load(object sender, EventArgs e)
{
}
}
}