View Javadoc
1   /*
2    * Copyright 2012-2025 CodeLibs Project and the Others.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13   * either express or implied. See the License for the specific language
14   * governing permissions and limitations under the License.
15   */
16  package org.codelibs.fess.app.web.admin.dict.kuromoji;
17  
18  import org.codelibs.fess.app.web.CrudMode;
19  import org.lastaflute.web.validation.Required;
20  import org.lastaflute.web.validation.theme.conversion.ValidateTypeFailure;
21  
22  import jakarta.validation.constraints.Size;
23  
24  /**
25   * Form class for creating Kuromoji dictionary entries.
26   * Kuromoji is a Japanese morphological analyzer and this form allows
27   * administrators to add custom dictionary entries for better Japanese text analysis.
28   *
29   */
30  public class CreateForm {
31  
32      /**
33       * Creates a new CreateForm instance.
34       */
35      public CreateForm() {
36          // Default constructor
37      }
38  
39      /** Dictionary identifier */
40      @Required
41      public String dictId;
42  
43      /** CRUD operation mode (CREATE, EDIT, etc.) */
44      @ValidateTypeFailure
45      public Integer crudMode;
46  
47      /** Token (word) to be added to the dictionary */
48      @Required
49      @Size(max = 1000)
50      public String token;
51  
52      /** Segmentation information for the token */
53      @Required
54      @Size(max = 1000)
55      public String segmentation;
56  
57      /** Reading (pronunciation) of the token in katakana */
58      @Required
59      @Size(max = 1000)
60      public String reading;
61  
62      /** Part of speech tag for the token */
63      @Required
64      @Size(max = 1000)
65      public String pos;
66  
67      /**
68       * Initializes the form with default values for creating a new Kuromoji dictionary entry.
69       */
70      public void initialize() {
71          crudMode = CrudMode.CREATE;
72      }
73  }