forked from c-amr/camr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_rest.sh
executable file
·183 lines (150 loc) · 4.96 KB
/
test_rest.sh
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
#!/bin/bash
host='localhost:5000'
if [ "$1" != "" ]; then
host="$1"
else
echo "usage: $0 [hostname:port]"
echo
echo "defaults to $host"
fi
echo
echo "Testing CAMR on $host"
echo
echo "Plaintext input, YAML output (without sentence split)"
echo
curl -X POST --header 'Content-Type: text/plain' --header 'Accept: application/yaml' -d '
I had thus learned a second fact of great importance: this was that the planet the little prince came from was scarcely any larger than a house! But that did not really surprise me much. I knew very well that in addition to the great planets -- such as the Earth, Jupiter, Mars, Venus -- to which we have given names, there are also hundreds of others, some of which are so small that one has a hard time seeing them through the telescope.
For information call the Service at (999) 111-12345 or (777) 222-87654.
' "http://$host/api/parse?fmt=yaml"
echo
echo
echo "Plaintext input, YAML output (with sentence split)"
echo
curl -X POST --header 'Content-Type: text/plain' --header 'Accept: application/yaml' -d '
I had thus learned a second fact of great importance: this was that the planet the little prince came from was scarcely any larger than a house! But that did not really surprise me much. I knew very well that in addition to the great planets -- such as the Earth, Jupiter, Mars, Venus -- to which we have given names, there are also hundreds of others, some of which are so small that one has a hard time seeing them through the telescope.
For information call the Service at (999) 111-12345 or (777) 222-87654.
' "http://$host/api/parse?fmt=yaml&ssplit=true"
echo
echo
echo "JSON input (array of objects), JSON output (without sentence split)"
echo
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '
[
{
"text": "First sentence. Second sentence.",
"some input field": "some id 1"
},
{
"text": "Third sentence.",
"some input field": "some id 2"
}
]
' "http://$host/api/parse?pretty=true"
echo
echo
echo "JSON input (array of objects), JSON output (with sentence split)"
echo
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '
[
{
"text": "First sentence. Second sentence.",
"some input field": "some id 1"
},
{
"text": "Third sentence.",
"some input field": "some id 2"
}
]
' "http://$host/api/parse?pretty=true&ssplit=true"
echo
echo
echo "JSON input (array of objects), YAML output (without sentence split)"
echo
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/yaml' -d '
[
{
"text": "First sentence. Second sentence.",
"some input field": "some id 1"
},
{
"text": "Third sentence.",
"some input field": "some id 2"
}
]
' "http://$host/api/parse?fmt=yaml"
echo
echo
echo "JSON input (array of objects), YAML output (with sentence split)"
echo
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/yaml' -d '
[
{
"text": "First sentence. Second sentence.",
"some input field": "some id 1"
},
{
"text": "Third sentence.",
"some input field": "some id 2"
}
]
' "http://$host/api/parse?fmt=yaml&ssplit=true"
echo
echo
echo "JSON input (array of strings), YAML output (without sentence split)"
echo
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/yaml' -d '
[
"First sentence. Second sentence.",
"Third sentence."
]
' "http://$host/api/parse?fmt=yaml"
echo
echo
echo "JSON input (array of strings), YAML output (with sentence split)"
echo
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/yaml' -d '
[
"First sentence. Second sentence.",
"Third sentence."
]
' "http://$host/api/parse?fmt=yaml&ssplit=true"
echo
echo
echo "YAML input (array of objects), YAML output (without sentence split)"
echo
curl -X POST --header 'Content-Type: application/yaml' --header 'Accept: application/yaml' -d '
- text: First sentence.
Second sentence.
custom field: some id 1
- text: Third sentence.
some input field: some id 2
' "http://$host/api/parse?fmt=yaml"
echo
echo
echo "YAML input (array of objects), YAML output (with sentence split)"
echo
curl -X POST --header 'Content-Type: application/yaml' --header 'Accept: application/yaml' -d '
- text: First sentence.
Second sentence.
some input field: some id 1
- text: Third sentence.
custom field: some id 2
' "http://$host/api/parse?fmt=yaml&ssplit=true"
echo
echo
echo "YAML input (array of strings), YAML output (without sentence split)"
echo
curl -X POST --header 'Content-Type: application/yaml' --header 'Accept: application/yaml' -d '
- First sentence. Second sentence.
- Third sentence.
' "http://$host/api/parse?fmt=yaml"
echo
echo
echo "YAML input (array of strings), YAML output (with sentence split)"
echo
curl -X POST --header 'Content-Type: application/yaml' --header 'Accept: application/yaml' -d '
- First sentence. Second sentence.
- Third sentence.
' "http://$host/api/parse?fmt=yaml&ssplit=true"
echo
echo