<commit_before># ====================================================================
#   Licensed under the Apache License, Version 2.0 (the "License");
#   you may not use this file except in compliance with the License.
#   You may obtain a copy of the License at
#
#       http://www.apache.org/licenses/LICENSE-2.0
#
#   Unless required by applicable law or agreed to in writing, software
#   distributed under the License is distributed on an "AS IS" BASIS,
#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#   See the License for the specific language governing permissions and
#   limitations under the License.
# ====================================================================
#
# Author: <NAME>
#
# FacetExample.py - a simple Facet example for PyLucene
#   (based on the Java counterpart from
#    package org.apache.lucene.facet.example.simple)
# ====================================================================

usage = """
  usage: python FacetExample.py [index | simple | drilldown]
  where
    'index' => create index for faceted search
    'simple'  => run simple faceted search
    'drilldown' => run faceted search with drilldown
"""

import os, sys, lucene

from lucene import FSDirectory, SimpleFSDirectory, Document, Field,\
    IndexWriter, IndexSearcher, IndexReader, IndexWriterConfig, \
    WhitespaceAnalyzer, StandardAnalyzer, \
    MatchAllDocsQuery, Sort, SortField, DecimalFormat, System, File, \
    TopFieldCollector, QueryParser, Version, BooleanQuery, BooleanClause, \
    DirectoryTaxonomyWriter, DirectoryTaxonomyReader, \
    CategoryDocumentBuilder, CategoryPath


# -----------------------------------------------------------------------------
# SimpleUtils:
# Documents title field
TITLE = "title"
TEXT = "text";

docTexts = [
    "the white car is the one I want.",
    "the white dog does not belong to anyone.",
]

# sample documents titles (for the title field).
<commit_msg>migrate to new imports style<commit_after># ====================================================================
#   Licensed under the Apache License, Version 2.0 (the "License");
#   you may not use this file except in compliance with the License.
#   You may obtain a copy of the License at
#
#       http://www.apache.org/licenses/LICENSE-2.0
#
#   Unless required by applicable law or agreed to in writing, software
#   distributed under the License is distributed on an "AS IS" BASIS,
#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#   See the License for the specific language governing permissions and
#   limitations under the License.
# ====================================================================
#
# Author: <NAME>
#
# FacetExample.py - a simple Facet example for PyLucene
#   (based on the Java counterpart from
#    package org.apache.lucene.facet.example.simple)
# ====================================================================

usage = """
  usage: python FacetExample.py [index | simple | drilldown]
  where
    'index' => create index for faceted search
    'simple'  => run simple faceted search
    'drilldown' => run faceted search with drilldown
"""

import os, sys, lucene

from java.io import File
from java.lang import System
from java.text import DecimalFormat

from org.apache.lucene.analysis.core import WhitespaceAnalyzer
from org.apache.lucene.analysis.standard import StandardAnalyzer
from org.apache.lucene.document import Document, Field
from org.apache.lucene.facet.taxonomy.directory import \
    DirectoryTaxonomyWriter, DirectoryTaxonomyReader
from org.apache.lucene.facet.taxonomy import \
    CategoryDocumentBuilder, CategoryPath
from org.apache.lucene.index import \
    IndexWriter, IndexSearcher, IndexReader, IndexWriterConfig
from org.apache.lucene.queryparser.classic import QueryParser
from org.apache.lucene.search import \
    MatchAllDocsQuery, Sort, SortField, BooleanQuery, BooleanClause, \
    TopFieldCollector
from org.apache.lucene.store import FSDirectory, SimpleFSDirectory
from org.apache.lucene.util import Version


# -----------------------------------------------------------------------------
# SimpleUtils:
# Documents title field
TITLE = "title"
TEXT = "text";

docTexts = [
    "the white car is the one I want.",
    "the white dog does not belong to anyone.",
]

# sample documents titles (for the title field).

{'fraction_non_alphanumeric': 0.19904131476831774, 'fraction_numerical': 0.0018260671079662178, 'mean_word_length': 3.7838427947598254, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5865438', 'n_tokens_mistral': 1142, 'n_tokens_neox': 1096, 'n_words': 410}