|
| 1 | +using System.Collections.Generic; |
| 2 | +using Newtonsoft.Json; |
| 3 | + |
| 4 | +namespace Nest |
| 5 | +{ |
| 6 | + /// <summary> |
| 7 | + ///The nori analyzer consists of the following tokenizer and token filters: |
| 8 | + ///<para> - nori_tokenizer</para> |
| 9 | + ///<para> - nori_part_of_speech token filter</para> |
| 10 | + ///<para> - nori_readingform token filter</para> |
| 11 | + ///<para> - lowercase token filter</para> |
| 12 | + /// </summary> |
| 13 | + public interface INoriAnalyzer : IAnalyzer |
| 14 | + { |
| 15 | + /// <inheritdoc cref="INoriTokenizer.DecompoundMode"/> |
| 16 | + [JsonProperty("decompound_mode")] |
| 17 | + NoriDecompoundMode? DecompoundMode { get; set; } |
| 18 | + |
| 19 | + /// <inheritdoc cref="INoriTokenizer.UserDictionary"/> |
| 20 | + [JsonProperty("user_dictionary")] |
| 21 | + string UserDictionary { get; set; } |
| 22 | + |
| 23 | + /// <inheritdoc cref="INoriPartOfSpeechTokenFilter.StopTags"/> |
| 24 | + [JsonProperty("stoptags")] |
| 25 | + IEnumerable<string> StopTags { get; set; } |
| 26 | + } |
| 27 | + |
| 28 | + /// <inheritdoc cref="INoriAnalyzer"/> |
| 29 | + public class NoriAnalyzer : AnalyzerBase, INoriAnalyzer |
| 30 | + { |
| 31 | + public NoriAnalyzer() : base("nori") {} |
| 32 | + |
| 33 | + /// <inheritdoc cref="INoriTokenizer.DecompoundMode"/> |
| 34 | + public NoriDecompoundMode? DecompoundMode { get; set; } |
| 35 | + |
| 36 | + /// <inheritdoc cref="INoriTokenizer.UserDictionary"/> |
| 37 | + public string UserDictionary { get; set; } |
| 38 | + |
| 39 | + ///<inheritdoc cref="INoriPartOfSpeechTokenFilter.StopTags" /> |
| 40 | + public IEnumerable<string> StopTags { get; set; } |
| 41 | + } |
| 42 | + |
| 43 | + /// <inheritdoc cref="INoriAnalyzer"/> |
| 44 | + public class NoriAnalyzerDescriptor : AnalyzerDescriptorBase<NoriAnalyzerDescriptor, INoriAnalyzer>, INoriAnalyzer |
| 45 | + { |
| 46 | + protected override string Type => "nori"; |
| 47 | + |
| 48 | + NoriDecompoundMode? INoriAnalyzer.DecompoundMode { get; set; } |
| 49 | + string INoriAnalyzer.UserDictionary { get; set; } |
| 50 | + IEnumerable<string> INoriAnalyzer.StopTags { get; set; } |
| 51 | + |
| 52 | + /// <inheritdoc cref="INoriTokenizer.DecompoundMode"/> |
| 53 | + public NoriAnalyzerDescriptor DecompoundMode(NoriDecompoundMode? mode) => Assign(a => a.DecompoundMode = mode); |
| 54 | + |
| 55 | + /// <inheritdoc cref="INoriTokenizer.UserDictionary"/> |
| 56 | + public NoriAnalyzerDescriptor UserDictionary(string path) => Assign(a => a.UserDictionary = path); |
| 57 | + |
| 58 | + ///<inheritdoc cref="INoriPartOfSpeechTokenFilter.StopTags" /> |
| 59 | + public NoriAnalyzerDescriptor StopTags(IEnumerable<string> stopTags) => Assign(a => a.StopTags = stopTags); |
| 60 | + |
| 61 | + ///<inheritdoc cref="INoriPartOfSpeechTokenFilter.StopTags" /> |
| 62 | + public NoriAnalyzerDescriptor StopTags(params string[] stopTags) => Assign(a => a.StopTags = stopTags); |
| 63 | + |
| 64 | + } |
| 65 | +} |
0 commit comments