-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnames.jsp
More file actions
70 lines (67 loc) · 1.69 KB
/
names.jsp
File metadata and controls
70 lines (67 loc) · 1.69 KB
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
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<% request.setCharacterEncoding("UTF-8"); %><%!
%>
<%@include file="common.jsp"%>
<%
String text = request.getParameter( "text" );
DicFreq dic = null;
if ( text != null) {
Tokenizer toks = new Tokenizer( text );
Occ occ;
dic = new DicFreq();
while ( (occ = toks.word()) != null ) {
if (!occ.tag().isName()) continue;
dic.inc(occ.graph(), occ.tag().code());
}
}
else {
text = "";
}
%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Index de noms</title>
<link rel="stylesheet" type="text/css" href="alix.css" />
</head>
<body>
<%@include file="menu.jsp"%>
<article id="article">
<h1>
<a href=".">Alix</a> : <a href="?">index de noms</a>
</h1>
<p>Soumettre un texte pour en tirer des noms, afin de </p>
<form method="post" action="">
<textarea name="text" style="width: 100%; height: 10em; "><%= text %></textarea>
<button type="submit">Envoyer</button>
</form>
<%
if ( dic != null ) {
%>
<table class="sortable">
<thead>
<th>N°</th>
<th>Nom</th>
<th>Nombre</th>
<th>Type</th>
</thead>
<%
int i = 1;
for (Entry entry: dic.byCount()) {
out.write("<tr>");
out.write("<td class=\'num\'>"+i+"</td>\n");
out.write("<td class=\'name\'>"+entry.label()+"</td>\n");
out.write("<td class=\'count\'>"+entry.count()+"</td>\n");
out.write("<td class=\'type\'>"+ Tag.label( entry.tag() )+"</td>\n");
i++;
}
%>
</table>
<%
}
%>
</article>
<script src="lib/Sortable.js">//</script>
</body>
</html>