1package no
2
3import (
4	"github.com/blevesearch/bleve/analysis"
5	"github.com/blevesearch/bleve/registry"
6)
7
8const StopName = "stop_no"
9
10// this content was obtained from:
11// lucene-4.7.2/analysis/common/src/resources/org/apache/lucene/analysis/snowball/
12// ` was changed to ' to allow for literal string
13
14var NorwegianStopWords = []byte(` | From svn.tartarus.org/snowball/trunk/website/algorithms/norwegian/stop.txt
15 | This file is distributed under the BSD License.
16 | See http://snowball.tartarus.org/license.php
17 | Also see http://www.opensource.org/licenses/bsd-license.html
18 |  - Encoding was converted to UTF-8.
19 |  - This notice was added.
20 |
21 | NOTE: To use this file with StopFilterFactory, you must specify format="snowball"
22
23 | A Norwegian stop word list. Comments begin with vertical bar. Each stop
24 | word is at the start of a line.
25
26 | This stop word list is for the dominant bokmål dialect. Words unique
27 | to nynorsk are marked *.
28
29 | Revised by Jan Bruusgaard <Jan.Bruusgaard@ssb.no>, Jan 2005
30
31og             | and
32i              | in
33jeg            | I
34det            | it/this/that
35at             | to (w. inf.)
36en             | a/an
37et             | a/an
38den            | it/this/that
39til            | to
40er             | is/am/are
41som            | who/that
42på             | on
43de             | they / you(formal)
44med            | with
45han            | he
46av             | of
47ikke           | not
48ikkje          | not *
49der            | there
50så             | so
51var            | was/were
52meg            | me
53seg            | you
54men            | but
55ett            | one
56har            | have
57om             | about
58vi             | we
59min            | my
60mitt           | my
61ha             | have
62hadde          | had
63hun            | she
64nå             | now
65over           | over
66da             | when/as
67ved            | by/know
68fra            | from
69du             | you
70ut             | out
71sin            | your
72dem            | them
73oss            | us
74opp            | up
75man            | you/one
76kan            | can
77hans           | his
78hvor           | where
79eller          | or
80hva            | what
81skal           | shall/must
82selv           | self (reflective)
83sjøl           | self (reflective)
84her            | here
85alle           | all
86vil            | will
87bli            | become
88ble            | became
89blei           | became *
90blitt          | have become
91kunne          | could
92inn            | in
93når            | when
94være           | be
95kom            | come
96noen           | some
97noe            | some
98ville          | would
99dere           | you
100som            | who/which/that
101deres          | their/theirs
102kun            | only/just
103ja             | yes
104etter          | after
105ned            | down
106skulle         | should
107denne          | this
108for            | for/because
109deg            | you
110si             | hers/his
111sine           | hers/his
112sitt           | hers/his
113mot            | against
114å              | to
115meget          | much
116hvorfor        | why
117dette          | this
118disse          | these/those
119uten           | without
120hvordan        | how
121ingen          | none
122din            | your
123ditt           | your
124blir           | become
125samme          | same
126hvilken        | which
127hvilke         | which (plural)
128sånn           | such a
129inni           | inside/within
130mellom         | between
131vår            | our
132hver           | each
133hvem           | who
134vors           | us/ours
135hvis           | whose
136både           | both
137bare           | only/just
138enn            | than
139fordi          | as/because
140før            | before
141mange          | many
142også           | also
143slik           | just
144vært           | been
145være           | to be
146båe            | both *
147begge          | both
148siden          | since
149dykk           | your *
150dykkar         | yours *
151dei            | they *
152deira          | them *
153deires         | theirs *
154deim           | them *
155di             | your (fem.) *
156då             | as/when *
157eg             | I *
158ein            | a/an *
159eit            | a/an *
160eitt           | a/an *
161elles          | or *
162honom          | he *
163hjå            | at *
164ho             | she *
165hoe            | she *
166henne          | her
167hennar         | her/hers
168hennes         | hers
169hoss           | how *
170hossen         | how *
171ikkje          | not *
172ingi           | noone *
173inkje          | noone *
174korleis        | how *
175korso          | how *
176kva            | what/which *
177kvar           | where *
178kvarhelst      | where *
179kven           | who/whom *
180kvi            | why *
181kvifor         | why *
182me             | we *
183medan          | while *
184mi             | my *
185mine           | my *
186mykje          | much *
187no             | now *
188nokon          | some (masc./neut.) *
189noka           | some (fem.) *
190nokor          | some *
191noko           | some *
192nokre          | some *
193si             | his/hers *
194sia            | since *
195sidan          | since *
196so             | so *
197somt           | some *
198somme          | some *
199um             | about*
200upp            | up *
201vere           | be *
202vore           | was *
203verte          | become *
204vort           | become *
205varte          | became *
206vart           | became *
207
208`)
209
210func TokenMapConstructor(config map[string]interface{}, cache *registry.Cache) (analysis.TokenMap, error) {
211	rv := analysis.NewTokenMap()
212	err := rv.LoadBytes(NorwegianStopWords)
213	return rv, err
214}
215
216func init() {
217	registry.RegisterTokenMap(StopName, TokenMapConstructor)
218}
219