diff --git a/_data/releases.yaml b/_data/releases.yaml index a6dfbee..ca78012 100644 --- a/_data/releases.yaml +++ b/_data/releases.yaml @@ -26,6 +26,7 @@ c: - {version: 2.1.0, date: 2009-08-18, gz: 1} - {version: 2.0.0, date: 2009-07-16, gz: 1} python: + - {version: 1.4.3, date: 2025-12-03, gz: 1, xz: 1, whl: 1, src_: 1} - {version: 1.4.2, date: 2025-04-28, gz: 1, xz: 1, whl: 1, src_: 1} - {version: 1.4.1, date: 2024-10-30, gz: 1, xz: 1, whl: 1, src_: 1} - {version: 1.4.0, date: 2024-10-29, gz: 1, xz: 1, whl: 1, src_: 1} @@ -43,6 +44,7 @@ python: - {version: 0.3.0, date: 2011-12-16, gz: 1, xz: 1} - {version: 0.2.0, date: 2011-09-02, gz: 1, xz: 1} java: + - {version: 0.13.1, date: 2025-12-02, gh: 1, jar: 1} - {version: 0.13.0, date: 2024-05-04, gh: 1, jar: 1} - {version: 0.12.4, date: 2023-11-07, xz: 1} - {version: 0.12.3, date: 2022-12-17, xz: 1} @@ -62,6 +64,7 @@ java: - {version: 0.6.0, date: 2009-08-17, gz: 1} - {version: 0.5.0, date: 2009-07-15, gz: 1} bin: + - {version: 4.0.0.10, date: 2025-12-03, linux_aarch64: 1} - {version: 4.0.0.8, date: 2025-04-27, linux_aarch64: 1} - {version: 4.0.0.6, date: 2024-09-29, linux_aarch64: 1} - {version: 4.0.0.5, date: 2024-09-10, linux_aarch64: 1} diff --git a/_includes/news.md b/_includes/news.md index baf07d9..db17a22 100644 --- a/_includes/news.md +++ b/_includes/news.md @@ -1,5 +1,31 @@ {% include links.md %} +## Binary build 4.0.0.10, 2025-12-03 + +[Binary build 4.0.0.10][bin-4.0.0.10] drops Python 3.8 support in the Python +binary packages, enables SIMD JPEG decoding on macOS x86_64, and updates +many dependencies. + +[bin-4.0.0.10]: https://github.com/openslide/openslide-bin/releases/tag/v4.0.0.10 + + +## OpenSlide Python version 1.4.3, 2025-12-03 + +[OpenSlide Python 1.4.3][python-1.4.3] adds support for +[free-threaded Python][] and drops support for Python 3.9. + +[python-1.4.3]: https://github.com/openslide/openslide-python/releases/tag/v1.4.3 +[free-threaded Python]: https://docs.python.org/3/howto/free-threading-python.html + + +## OpenSlide Java version 0.13.1, 2025-12-02 + +[OpenSlide Java 0.13.1][java-0.13.1] fixes backward compatibility of JARs +built with Java newer than 22. + +[java-0.13.1]: https://github.com/openslide/openslide-java/releases/tag/v0.13.1 + + ## OpenSlide Python version 1.4.2, 2025-04-28 [OpenSlide Python 1.4.2][python-1.4.2] drops support for Python 3.8 and adds diff --git a/api/python/index.html b/api/python/index.html index ee85662..f9150a1 100644 --- a/api/python/index.html +++ b/api/python/index.html @@ -5,20 +5,20 @@ - OpenSlide Python — OpenSlide Python 1.4.2 documentation + OpenSlide Python — OpenSlide Python 1.4.3 documentation - - - + + + @@ -90,7 +90,7 @@

Basic usage

OpenSlide objects

-class openslide.OpenSlide(filename: str | bytes | PathLike[Any])
+class openslide.OpenSlide(filename: str | bytes | PathLike[Any])

An open whole-slide image.

If any operation on the object fails, OpenSlideError is raised. OpenSlide has latching error semantics: once OpenSlideError is @@ -113,11 +113,11 @@

Basic usage
-classmethod detect_format(filename: str | bytes | PathLike[Any]) str | None
+classmethod detect_format(filename: str | bytes | PathLike[Any]) str | None

Return a string describing the format vendor of the specified file. This string is also accessible via the PROPERTY_NAME_VENDOR property.

-

If the file is not recognized, return None.

+

If the file is not recognized, return None.

Parameters:

filename – the file to examine

@@ -132,7 +132,7 @@

Basic usagelevel_count - 1 (lowest resolution).

Type:
-

int

+

int

@@ -143,7 +143,7 @@

Basic usage(width, height) tuple for level 0 of the slide.

Type:
-

tuple[int, int]

+

tuple[int, int]

@@ -155,7 +155,7 @@

Basic usagelevel_dimensions[k] are the dimensions of level k.

Type:
-

tuple[tuple[int, int], …]

+

tuple[tuple[int, int], …]

@@ -167,7 +167,7 @@

Basic usagelevel_downsamples[k] is the downsample factor of level k.

Type:
-

tuple[float, …]

+

tuple[float, …]

@@ -176,12 +176,12 @@

Basic usage properties

Metadata about the slide, in the form of a -Mapping from OpenSlide property name to +Mapping from OpenSlide property name to property value. OpenSlide provides some Standard properties, plus additional properties that vary by slide format.

Type:
-

Mapping[str, str]

+

Mapping[str, str]

@@ -190,12 +190,12 @@

Basic usage associated_images

Images, such as label or macro images, which are associated with this -slide. This is a Mapping from image -name to RGBA Image.

+slide. This is a Mapping from image +name to RGBA Image.

Unlike in the C interface, these images are not premultiplied.

Type:
-

Mapping[str, Image]

+

Mapping[str, Image]

@@ -204,18 +204,18 @@

Basic usage color_profile

The embedded color profile for this slide, -or None if not available.

+or None if not available.

Type:
-

ImageCmsProfile | None

+

ImageCmsProfile | None

-read_region(location: tuple[int, int], level: int, size: tuple[int, int]) Image
-

Return an RGBA Image containing the contents of +read_region(location: tuple[int, int], level: int, size: tuple[int, int]) Image +

Return an RGBA Image containing the contents of the specified region.

Unlike in the C interface, the image data is not premultiplied.

@@ -232,7 +232,7 @@

Basic usage
-get_best_level_for_downsample(downsample: float) int
+get_best_level_for_downsample(downsample: float) int

Return the best level for displaying the given downsample.

Parameters:
@@ -243,8 +243,8 @@

Basic usage
-get_thumbnail(size: tuple[int, int]) Image
-

Return an Image containing an RGB thumbnail of the +get_thumbnail(size: tuple[int, int]) Image +

Return an Image containing an RGB thumbnail of the slide.

Parameters:
@@ -256,7 +256,7 @@

Basic usage
-set_cache(cache: OpenSlideCache) None
+set_cache(cache: OpenSlideCache) None

Use the specified OpenSlideCache to store recently decoded slide tiles. By default, the OpenSlide has a private cache with a default size.

@@ -272,7 +272,7 @@

Basic usage
-close() None
+close() None

Close the OpenSlide object.

@@ -284,15 +284,15 @@

Basic usagebytes object in -Image.info['icc_profile']. If no +a bytes object in +Image.info['icc_profile']. If no profile is available, the icc_profile dictionary key is absent.

To include the profile in an image file when saving the image to disk:

image.save(filename, icc_profile=image.info.get('icc_profile'))
 

To perform color conversions using the profile, import it into -ImageCms. For example, to synthesize an sRGB profile +ImageCms. For example, to synthesize an sRGB profile and use it to transform an image for display, with the default rendering intent of the image’s profile:

from io import BytesIO
@@ -310,8 +310,8 @@ 

Basic usageOpenSlide.color_profile, already parsed into an -ImageCmsProfile object. You can save processing time -by building an ImageCmsTransform for the slide and +ImageCmsProfile object. You can save processing time +by building an ImageCmsTransform for the slide and reusing it for multiple slide regions:

toProfile = ImageCms.createProfile('sRGB')
 intent = ImageCms.getDefaultIntent(slide.color_profile)
@@ -327,7 +327,7 @@ 

Basic usage

-class openslide.OpenSlideCache(capacity: int)
+class openslide.OpenSlideCache(capacity: int)

An in-memory tile cache.

Tile caches can be attached to one or more OpenSlide objects with OpenSlide.set_cache() to cache recently-decoded tiles. By @@ -425,7 +425,7 @@

Caching

Exceptions

-exception openslide.OpenSlideError
+exception openslide.OpenSlideError

An error produced by the OpenSlide library.

Once OpenSlideError has been raised by a particular OpenSlide, all future operations on that OpenSlide @@ -435,14 +435,14 @@

Exceptions
-exception openslide.OpenSlideUnsupportedFormatError
+exception openslide.OpenSlideUnsupportedFormatError

OpenSlide does not support the requested file. Subclass of OpenSlideError.

-exception openslide.OpenSlideVersionError
+exception openslide.OpenSlideVersionError

This version of OpenSlide does not support the requested functionality. Subclass of OpenSlideError.

@@ -453,28 +453,28 @@

Exceptions

Wrapping a Pillow Image

-class openslide.AbstractSlide
+class openslide.AbstractSlide

The abstract base class of OpenSlide and ImageSlide.

-class openslide.ImageSlide(file: str | bytes | PathLike[Any] | Image)
-

A wrapper around an Image object that provides an +class openslide.ImageSlide(file: str | bytes | PathLike[Any] | Image) +

A wrapper around an Image object that provides an OpenSlide-compatible API.

Parameters:
-

file – a filename or Image object

+

file – a filename or Image object

Raises:
-

OSError – if the file cannot be opened

+

OSError – if the file cannot be opened

-openslide.open_slide(filename: str | bytes | PathLike[Any]) OpenSlide | ImageSlide
+openslide.open_slide(filename: str | bytes | PathLike[Any]) OpenSlide | ImageSlide

Return an OpenSlide for whole-slide images and an ImageSlide for other types of images.

@@ -485,7 +485,7 @@

Exceptions
  • OpenSlideError – if the file is recognized by OpenSlide but an error occurred

  • -
  • OSError – if the file is not recognized at all

  • +
  • OSError – if the file is not recognized at all

@@ -500,7 +500,7 @@

Exceptions
-class openslide.deepzoom.DeepZoomGenerator(osr: AbstractSlide, tile_size: int = 254, overlap: int = 1, limit_bounds: bool = False)
+class openslide.deepzoom.DeepZoomGenerator(osr: AbstractSlide, tile_size: int = 254, overlap: int = 1, limit_bounds: bool = False)

A Deep Zoom generator that wraps an OpenSlide object, ImageSlide object, or user-provided instance of AbstractSlide.

@@ -512,7 +512,7 @@

Exceptionstile_size + 2 * overlap should be a power of two.

  • overlap – the number of extra pixels to add to each interior edge of a tile

  • -
  • limit_boundsTrue to render only the non-empty slide region

  • +
  • limit_boundsTrue to render only the non-empty slide region

  • @@ -522,7 +522,7 @@

    Exceptions
    Type:
    -

    int

    +

    int

    @@ -533,7 +533,7 @@

    Exceptions
    Type:
    -

    int

    +

    int

    @@ -545,7 +545,7 @@

    Exceptionslevel_tiles[k] are the tile counts of level k.

    Type:
    -

    tuple[tuple[int, int], …]

    +

    tuple[tuple[int, int], …]

    @@ -557,14 +557,14 @@

    Exceptionslevel_dimensions[k] are the dimensions of level k.

    Type:
    -

    tuple[tuple[int, int], …]

    +

    tuple[tuple[int, int], …]

    -get_dzi(format: str) str
    +get_dzi(format: str) str

    Return a string containing the XML metadata for the Deep Zoom .dzi file.

    @@ -577,8 +577,8 @@

    Exceptions
    -get_tile(level: int, address: tuple[int, int]) Image
    -

    Return an RGB Image for a tile.

    +get_tile(level: int, address: tuple[int, int]) Image +

    Return an RGB Image for a tile.

    Parameters:
      @@ -592,7 +592,7 @@

      Exceptions
      -get_tile_coordinates(level: int, address: tuple[int, int]) tuple[tuple[int, int], int, tuple[int, int]]
      +get_tile_coordinates(level: int, address: tuple[int, int]) tuple[tuple[int, int], int, tuple[int, int]]

      Return the OpenSlide.read_region() arguments corresponding to the specified tile.

      Most applications should use get_tile() instead.

      @@ -609,7 +609,7 @@

      Exceptions
      -get_tile_dimensions(level: int, address: tuple[int, int]) tuple[int, int]
      +get_tile_dimensions(level: int, address: tuple[int, int]) tuple[int, int]

      Return a (pixels_x, pixels_y) tuple for the specified tile.

      Parameters:
      @@ -745,13 +745,13 @@

      This Page

      \ No newline at end of file diff --git a/api/python/objects.inv b/api/python/objects.inv index ddafef8..b164239 100644 Binary files a/api/python/objects.inv and b/api/python/objects.inv differ diff --git a/api/python/search.html b/api/python/search.html index 57e16e0..ecabaff 100644 --- a/api/python/search.html +++ b/api/python/search.html @@ -4,14 +4,14 @@ - Search — OpenSlide Python 1.4.2 documentation + Search — OpenSlide Python 1.4.3 documentation - - - + + + @@ -24,7 +24,7 @@ @@ -75,13 +75,13 @@

      Search

      \ No newline at end of file diff --git a/api/python/searchindex.js b/api/python/searchindex.js index 808fc5d..d3e6b68 100644 --- a/api/python/searchindex.js +++ b/api/python/searchindex.js @@ -1 +1 @@ -Search.setIndex({"alltitles":{"Basic usage":[[0,"basic-usage"]],"Caching":[[0,"caching"]],"Color management":[[0,"color-management"]],"Deep Zoom support":[[0,"module-openslide.deepzoom"]],"Example programs":[[0,"example-programs"]],"Exceptions":[[0,"exceptions"]],"Installing":[[0,"installing"]],"OpenSlide Python":[[0,null]],"OpenSlide objects":[[0,"module-openslide"]],"Standard properties":[[0,"standard-properties"]],"Wrapping a Pillow Image":[[0,"wrapping-a-pillow-image"]]},"docnames":["index"],"envversion":{"sphinx":65,"sphinx.domains.c":3,"sphinx.domains.changeset":1,"sphinx.domains.citation":1,"sphinx.domains.cpp":9,"sphinx.domains.index":1,"sphinx.domains.javascript":3,"sphinx.domains.math":2,"sphinx.domains.python":4,"sphinx.domains.rst":2,"sphinx.domains.std":2,"sphinx.ext.intersphinx":1},"filenames":["index.rst"],"indexentries":{"abstractslide (class in openslide)":[[0,"openslide.AbstractSlide",false]],"associated_images (openslide.openslide attribute)":[[0,"openslide.OpenSlide.associated_images",false]],"close() (openslide.openslide method)":[[0,"openslide.OpenSlide.close",false]],"color_profile (openslide.openslide attribute)":[[0,"openslide.OpenSlide.color_profile",false]],"deepzoomgenerator (class in openslide.deepzoom)":[[0,"openslide.deepzoom.DeepZoomGenerator",false]],"detect_format() (openslide.openslide class method)":[[0,"openslide.OpenSlide.detect_format",false]],"dimensions (openslide.openslide attribute)":[[0,"openslide.OpenSlide.dimensions",false]],"get_best_level_for_downsample() (openslide.openslide method)":[[0,"openslide.OpenSlide.get_best_level_for_downsample",false]],"get_dzi() (openslide.deepzoom.deepzoomgenerator method)":[[0,"openslide.deepzoom.DeepZoomGenerator.get_dzi",false]],"get_thumbnail() (openslide.openslide method)":[[0,"openslide.OpenSlide.get_thumbnail",false]],"get_tile() (openslide.deepzoom.deepzoomgenerator method)":[[0,"openslide.deepzoom.DeepZoomGenerator.get_tile",false]],"get_tile_coordinates() (openslide.deepzoom.deepzoomgenerator method)":[[0,"openslide.deepzoom.DeepZoomGenerator.get_tile_coordinates",false]],"get_tile_dimensions() (openslide.deepzoom.deepzoomgenerator method)":[[0,"openslide.deepzoom.DeepZoomGenerator.get_tile_dimensions",false]],"imageslide (class in openslide)":[[0,"openslide.ImageSlide",false]],"level_count (openslide.deepzoom.deepzoomgenerator attribute)":[[0,"openslide.deepzoom.DeepZoomGenerator.level_count",false]],"level_count (openslide.openslide attribute)":[[0,"openslide.OpenSlide.level_count",false]],"level_dimensions (openslide.deepzoom.deepzoomgenerator attribute)":[[0,"openslide.deepzoom.DeepZoomGenerator.level_dimensions",false]],"level_dimensions (openslide.openslide attribute)":[[0,"openslide.OpenSlide.level_dimensions",false]],"level_downsamples (openslide.openslide attribute)":[[0,"openslide.OpenSlide.level_downsamples",false]],"level_tiles (openslide.deepzoom.deepzoomgenerator attribute)":[[0,"openslide.deepzoom.DeepZoomGenerator.level_tiles",false]],"module":[[0,"module-openslide",false],[0,"module-openslide.deepzoom",false]],"open_slide() (in module openslide)":[[0,"openslide.open_slide",false]],"openslide":[[0,"module-openslide",false]],"openslide (class in openslide)":[[0,"openslide.OpenSlide",false]],"openslide.deepzoom":[[0,"module-openslide.deepzoom",false]],"openslidecache (class in openslide)":[[0,"openslide.OpenSlideCache",false]],"openslideerror":[[0,"openslide.OpenSlideError",false]],"openslideunsupportedformaterror":[[0,"openslide.OpenSlideUnsupportedFormatError",false]],"openslideversionerror":[[0,"openslide.OpenSlideVersionError",false]],"properties (openslide.openslide attribute)":[[0,"openslide.OpenSlide.properties",false]],"property_name_background_color (in module openslide)":[[0,"openslide.PROPERTY_NAME_BACKGROUND_COLOR",false]],"property_name_bounds_height (in module openslide)":[[0,"openslide.PROPERTY_NAME_BOUNDS_HEIGHT",false]],"property_name_bounds_width (in module openslide)":[[0,"openslide.PROPERTY_NAME_BOUNDS_WIDTH",false]],"property_name_bounds_x (in module openslide)":[[0,"openslide.PROPERTY_NAME_BOUNDS_X",false]],"property_name_bounds_y (in module openslide)":[[0,"openslide.PROPERTY_NAME_BOUNDS_Y",false]],"property_name_comment (in module openslide)":[[0,"openslide.PROPERTY_NAME_COMMENT",false]],"property_name_mpp_x (in module openslide)":[[0,"openslide.PROPERTY_NAME_MPP_X",false]],"property_name_mpp_y (in module openslide)":[[0,"openslide.PROPERTY_NAME_MPP_Y",false]],"property_name_objective_power (in module openslide)":[[0,"openslide.PROPERTY_NAME_OBJECTIVE_POWER",false]],"property_name_quickhash1 (in module openslide)":[[0,"openslide.PROPERTY_NAME_QUICKHASH1",false]],"property_name_vendor (in module openslide)":[[0,"openslide.PROPERTY_NAME_VENDOR",false]],"read_region() (openslide.openslide method)":[[0,"openslide.OpenSlide.read_region",false]],"set_cache() (openslide.openslide method)":[[0,"openslide.OpenSlide.set_cache",false]],"tile_count (openslide.deepzoom.deepzoomgenerator attribute)":[[0,"openslide.deepzoom.DeepZoomGenerator.tile_count",false]]},"objects":{"":[[0,0,0,"-","openslide"]],"openslide":[[0,1,1,"","AbstractSlide"],[0,1,1,"","ImageSlide"],[0,1,1,"","OpenSlide"],[0,1,1,"","OpenSlideCache"],[0,4,1,"","OpenSlideError"],[0,4,1,"","OpenSlideUnsupportedFormatError"],[0,4,1,"","OpenSlideVersionError"],[0,5,1,"","PROPERTY_NAME_BACKGROUND_COLOR"],[0,5,1,"","PROPERTY_NAME_BOUNDS_HEIGHT"],[0,5,1,"","PROPERTY_NAME_BOUNDS_WIDTH"],[0,5,1,"","PROPERTY_NAME_BOUNDS_X"],[0,5,1,"","PROPERTY_NAME_BOUNDS_Y"],[0,5,1,"","PROPERTY_NAME_COMMENT"],[0,5,1,"","PROPERTY_NAME_MPP_X"],[0,5,1,"","PROPERTY_NAME_MPP_Y"],[0,5,1,"","PROPERTY_NAME_OBJECTIVE_POWER"],[0,5,1,"","PROPERTY_NAME_QUICKHASH1"],[0,5,1,"","PROPERTY_NAME_VENDOR"],[0,0,0,"-","deepzoom"],[0,6,1,"","open_slide"]],"openslide.OpenSlide":[[0,2,1,"","associated_images"],[0,3,1,"","close"],[0,2,1,"","color_profile"],[0,3,1,"","detect_format"],[0,2,1,"","dimensions"],[0,3,1,"","get_best_level_for_downsample"],[0,3,1,"","get_thumbnail"],[0,2,1,"","level_count"],[0,2,1,"","level_dimensions"],[0,2,1,"","level_downsamples"],[0,2,1,"","properties"],[0,3,1,"","read_region"],[0,3,1,"","set_cache"]],"openslide.deepzoom":[[0,1,1,"","DeepZoomGenerator"]],"openslide.deepzoom.DeepZoomGenerator":[[0,3,1,"","get_dzi"],[0,3,1,"","get_tile"],[0,3,1,"","get_tile_coordinates"],[0,3,1,"","get_tile_dimensions"],[0,2,1,"","level_count"],[0,2,1,"","level_dimensions"],[0,2,1,"","level_tiles"],[0,2,1,"","tile_count"]]},"objnames":{"0":["py","module","Python module"],"1":["py","class","Python class"],"2":["py","attribute","Python attribute"],"3":["py","method","Python method"],"4":["py","exception","Python exception"],"5":["py","data","Python data"],"6":["py","function","Python function"]},"objtypes":{"0":"py:module","1":"py:class","2":"py:attribute","3":"py:method","4":"py:exception","5":"py:data","6":"py:function"},"terms":{"":0,"0":0,"1":0,"2":0,"254":0,"4":0,"A":0,"As":0,"By":0,"For":0,"If":0,"It":0,"On":0,"Or":0,"The":0,"Then":0,"These":0,"To":0,"abil":0,"about":0,"absent":0,"abstract":0,"abstractslid":0,"access":0,"add":0,"add_dll_directori":0,"addit":0,"address":0,"after":0,"all":0,"allow":0,"alreadi":0,"also":0,"amount":0,"an":0,"anaconda":0,"ani":0,"aperio":0,"api":0,"applic":0,"applytransform":0,"apt":0,"ar":0,"argument":0,"around":0,"associ":0,"associated_imag":0,"attach":0,"attribut":0,"automat":0,"avail":0,"background":0,"base":0,"been":0,"best":0,"bif":0,"bin":0,"binari":0,"bool":0,"both":0,"bound":0,"browser":0,"build":0,"buildtransform":0,"byte":0,"bytesio":0,"c":0,"call":0,"can":0,"cannot":0,"capac":0,"case":0,"class":0,"classmethod":0,"close":0,"closest":0,"color_profil":0,"column":0,"comfort":0,"comment":0,"commonli":0,"compat":0,"complet":0,"config":0,"conflict":0,"consid":0,"contain":0,"content":0,"context":0,"conveni":0,"convers":0,"convert":0,"coordin":0,"correspond":0,"count":0,"createprofil":0,"czi":0,"data":0,"dcm":0,"decod":0,"deepzoom":0,"deepzoom_multiserv":0,"deepzoom_serv":0,"deepzoom_til":0,"deepzoomgener":0,"default":0,"delet":0,"deliveri":0,"describ":0,"design":0,"desir":0,"detect_format":0,"dicom":0,"dictionari":0,"differ":0,"digit":0,"dimens":0,"directori":0,"disk":0,"displai":0,"dnf":0,"do":0,"doe":0,"download":0,"downsampl":0,"dzi":0,"each":0,"easiest":0,"easili":0,"edg":0,"els":0,"embed":0,"empti":0,"entir":0,"error":0,"etc":0,"everi":0,"examin":0,"exit":0,"extra":0,"extract":0,"factor":0,"fail":0,"fals":0,"file":0,"filenam":0,"float":0,"form":0,"format":0,"former":0,"frame":0,"from":0,"fromprofil":0,"function":0,"futur":0,"gener":0,"get":0,"get_best_level_for_downsampl":0,"get_dzi":0,"get_thumbnail":0,"get_til":0,"get_tile_coordin":0,"get_tile_dimens":0,"getdefaultint":0,"getopenprofil":0,"gigabyt":0,"give":0,"given":0,"gnu":0,"ha":0,"hamamatsu":0,"hasattr":0,"have":0,"height":0,"hex":0,"high":0,"highest":0,"html":0,"i":0,"icc":0,"icc_profil":0,"identif":0,"imagecm":0,"imagecmsprofil":0,"imagecmstransform":0,"imageslid":0,"import":0,"includ":0,"index":0,"individu":0,"info":0,"insid":0,"instanc":0,"instead":0,"int":0,"intend":0,"intent":0,"interfac":0,"interior":0,"io":0,"its":0,"jpeg":0,"k":0,"kei":0,"known":0,"label":0,"latch":0,"left":0,"leica":0,"lesser":0,"level":0,"level_count":0,"level_dimens":0,"level_downsampl":0,"level_til":0,"librari":0,"licens":0,"limit_bound":0,"link":0,"linux":0,"list":0,"ll":0,"locat":0,"lowest":0,"maco":0,"macport":0,"macro":0,"mai":0,"map":0,"maximum":0,"memori":0,"metadata":0,"micron":0,"mirax":0,"mix":0,"modul":0,"more":0,"most":0,"mrx":0,"multi":0,"multipl":0,"must":0,"name":0,"ndpi":0,"need":0,"non":0,"none":0,"number":0,"o":0,"occupi":0,"occur":0,"older":0,"onc":0,"one":0,"onli":0,"open":0,"open_slid":0,"openslide_path":0,"openslidecach":0,"openslideerror":0,"openslideunsupportedformaterror":0,"openslideversionerror":0,"oper":0,"option":0,"oserror":0,"osr":0,"other":0,"overlap":0,"own":0,"packag":0,"page":0,"paramet":0,"pars":0,"particular":0,"path":0,"pathlik":0,"pathologi":0,"per":0,"perform":0,"philip":0,"pil":0,"pip":0,"pixel":0,"pixels_i":0,"pixels_x":0,"plu":0,"png":0,"power":0,"premultipli":0,"privat":0,"process":0,"produc":0,"product":0,"profil":0,"profiletoprofil":0,"property_name_background_color":0,"property_name_bounds_height":0,"property_name_bounds_i":0,"property_name_bounds_width":0,"property_name_bounds_x":0,"property_name_com":0,"property_name_mpp_i":0,"property_name_mpp_x":0,"property_name_objective_pow":0,"property_name_quickhash1":0,"property_name_vendor":0,"provid":0,"public":0,"py":0,"pyramid":0,"quickhash":0,"r":0,"rais":0,"ram":0,"read":0,"read_region":0,"recent":0,"recogn":0,"rectangl":0,"refer":0,"region":0,"releas":0,"render":0,"repres":0,"request":0,"requir":0,"resolut":0,"return":0,"reus":0,"rgb":0,"rgba":0,"row":0,"sakura":0,"same":0,"save":0,"scn":0,"semant":0,"separ":0,"serv":0,"server":0,"set_cach":0,"sever":0,"should":0,"similar":0,"simpl":0,"sinc":0,"singl":0,"size":0,"slide":0,"small":0,"so":0,"some":0,"sourc":0,"specifi":0,"srgb":0,"statement":0,"store":0,"str":0,"string":0,"subclass":0,"sum":0,"sv":0,"svslide":0,"synthes":0,"system":0,"ten":0,"term":0,"than":0,"them":0,"thi":0,"thumbnail":0,"tif":0,"tiff":0,"tile":0,"tile_count":0,"tile_s":0,"tiles_i":0,"tiles_x":0,"time":0,"tool":0,"top":0,"toprofil":0,"total":0,"transform":0,"tree":0,"trestl":0,"triplet":0,"true":0,"tupl":0,"two":0,"type":0,"typic":0,"uncompress":0,"under":0,"underli":0,"unlik":0,"upon":0,"us":0,"user":0,"valu":0,"vari":0,"vendor":0,"ventana":0,"version":0,"via":0,"view":0,"viewer":0,"vip":0,"virtual":0,"vm":0,"vmu":0,"wai":0,"web":0,"when":0,"whenev":0,"which":0,"whole":0,"width":0,"win64":0,"window":0,"within":0,"without":0,"wrapper":0,"x":0,"xml":0,"y":0,"you":0,"zeiss":0,"zoomabl":0},"titles":["OpenSlide Python"],"titleterms":{"basic":0,"cach":0,"color":0,"deep":0,"exampl":0,"except":0,"imag":0,"instal":0,"manag":0,"object":0,"openslid":0,"pillow":0,"program":0,"properti":0,"python":0,"standard":0,"support":0,"usag":0,"wrap":0,"zoom":0}}) \ No newline at end of file +Search.setIndex({"alltitles":{"Basic usage":[[0,"basic-usage"]],"Caching":[[0,"caching"]],"Color management":[[0,"color-management"]],"Deep Zoom support":[[0,"module-openslide.deepzoom"]],"Example programs":[[0,"example-programs"]],"Exceptions":[[0,"exceptions"]],"Installing":[[0,"installing"]],"OpenSlide Python":[[0,null]],"OpenSlide objects":[[0,"module-openslide"]],"Standard properties":[[0,"standard-properties"]],"Wrapping a Pillow Image":[[0,"wrapping-a-pillow-image"]]},"docnames":["index"],"envversion":{"sphinx":66,"sphinx.domains.c":3,"sphinx.domains.changeset":1,"sphinx.domains.citation":1,"sphinx.domains.cpp":9,"sphinx.domains.index":1,"sphinx.domains.javascript":3,"sphinx.domains.math":2,"sphinx.domains.python":4,"sphinx.domains.rst":2,"sphinx.domains.std":2,"sphinx.ext.intersphinx":1},"filenames":["index.rst"],"indexentries":{"abstractslide (class in openslide)":[[0,"openslide.AbstractSlide",false]],"associated_images (openslide.openslide attribute)":[[0,"openslide.OpenSlide.associated_images",false]],"close() (openslide.openslide method)":[[0,"openslide.OpenSlide.close",false]],"color_profile (openslide.openslide attribute)":[[0,"openslide.OpenSlide.color_profile",false]],"deepzoomgenerator (class in openslide.deepzoom)":[[0,"openslide.deepzoom.DeepZoomGenerator",false]],"detect_format() (openslide.openslide class method)":[[0,"openslide.OpenSlide.detect_format",false]],"dimensions (openslide.openslide attribute)":[[0,"openslide.OpenSlide.dimensions",false]],"get_best_level_for_downsample() (openslide.openslide method)":[[0,"openslide.OpenSlide.get_best_level_for_downsample",false]],"get_dzi() (openslide.deepzoom.deepzoomgenerator method)":[[0,"openslide.deepzoom.DeepZoomGenerator.get_dzi",false]],"get_thumbnail() (openslide.openslide method)":[[0,"openslide.OpenSlide.get_thumbnail",false]],"get_tile() (openslide.deepzoom.deepzoomgenerator method)":[[0,"openslide.deepzoom.DeepZoomGenerator.get_tile",false]],"get_tile_coordinates() (openslide.deepzoom.deepzoomgenerator method)":[[0,"openslide.deepzoom.DeepZoomGenerator.get_tile_coordinates",false]],"get_tile_dimensions() (openslide.deepzoom.deepzoomgenerator method)":[[0,"openslide.deepzoom.DeepZoomGenerator.get_tile_dimensions",false]],"imageslide (class in openslide)":[[0,"openslide.ImageSlide",false]],"level_count (openslide.deepzoom.deepzoomgenerator attribute)":[[0,"openslide.deepzoom.DeepZoomGenerator.level_count",false]],"level_count (openslide.openslide attribute)":[[0,"openslide.OpenSlide.level_count",false]],"level_dimensions (openslide.deepzoom.deepzoomgenerator attribute)":[[0,"openslide.deepzoom.DeepZoomGenerator.level_dimensions",false]],"level_dimensions (openslide.openslide attribute)":[[0,"openslide.OpenSlide.level_dimensions",false]],"level_downsamples (openslide.openslide attribute)":[[0,"openslide.OpenSlide.level_downsamples",false]],"level_tiles (openslide.deepzoom.deepzoomgenerator attribute)":[[0,"openslide.deepzoom.DeepZoomGenerator.level_tiles",false]],"module":[[0,"module-openslide",false],[0,"module-openslide.deepzoom",false]],"open_slide() (in module openslide)":[[0,"openslide.open_slide",false]],"openslide":[[0,"module-openslide",false]],"openslide (class in openslide)":[[0,"openslide.OpenSlide",false]],"openslide.deepzoom":[[0,"module-openslide.deepzoom",false]],"openslidecache (class in openslide)":[[0,"openslide.OpenSlideCache",false]],"openslideerror":[[0,"openslide.OpenSlideError",false]],"openslideunsupportedformaterror":[[0,"openslide.OpenSlideUnsupportedFormatError",false]],"openslideversionerror":[[0,"openslide.OpenSlideVersionError",false]],"properties (openslide.openslide attribute)":[[0,"openslide.OpenSlide.properties",false]],"property_name_background_color (in module openslide)":[[0,"openslide.PROPERTY_NAME_BACKGROUND_COLOR",false]],"property_name_bounds_height (in module openslide)":[[0,"openslide.PROPERTY_NAME_BOUNDS_HEIGHT",false]],"property_name_bounds_width (in module openslide)":[[0,"openslide.PROPERTY_NAME_BOUNDS_WIDTH",false]],"property_name_bounds_x (in module openslide)":[[0,"openslide.PROPERTY_NAME_BOUNDS_X",false]],"property_name_bounds_y (in module openslide)":[[0,"openslide.PROPERTY_NAME_BOUNDS_Y",false]],"property_name_comment (in module openslide)":[[0,"openslide.PROPERTY_NAME_COMMENT",false]],"property_name_mpp_x (in module openslide)":[[0,"openslide.PROPERTY_NAME_MPP_X",false]],"property_name_mpp_y (in module openslide)":[[0,"openslide.PROPERTY_NAME_MPP_Y",false]],"property_name_objective_power (in module openslide)":[[0,"openslide.PROPERTY_NAME_OBJECTIVE_POWER",false]],"property_name_quickhash1 (in module openslide)":[[0,"openslide.PROPERTY_NAME_QUICKHASH1",false]],"property_name_vendor (in module openslide)":[[0,"openslide.PROPERTY_NAME_VENDOR",false]],"read_region() (openslide.openslide method)":[[0,"openslide.OpenSlide.read_region",false]],"set_cache() (openslide.openslide method)":[[0,"openslide.OpenSlide.set_cache",false]],"tile_count (openslide.deepzoom.deepzoomgenerator attribute)":[[0,"openslide.deepzoom.DeepZoomGenerator.tile_count",false]]},"objects":{"":[[0,0,0,"-","openslide"]],"openslide":[[0,1,1,"","AbstractSlide"],[0,1,1,"","ImageSlide"],[0,1,1,"","OpenSlide"],[0,1,1,"","OpenSlideCache"],[0,4,1,"","OpenSlideError"],[0,4,1,"","OpenSlideUnsupportedFormatError"],[0,4,1,"","OpenSlideVersionError"],[0,5,1,"","PROPERTY_NAME_BACKGROUND_COLOR"],[0,5,1,"","PROPERTY_NAME_BOUNDS_HEIGHT"],[0,5,1,"","PROPERTY_NAME_BOUNDS_WIDTH"],[0,5,1,"","PROPERTY_NAME_BOUNDS_X"],[0,5,1,"","PROPERTY_NAME_BOUNDS_Y"],[0,5,1,"","PROPERTY_NAME_COMMENT"],[0,5,1,"","PROPERTY_NAME_MPP_X"],[0,5,1,"","PROPERTY_NAME_MPP_Y"],[0,5,1,"","PROPERTY_NAME_OBJECTIVE_POWER"],[0,5,1,"","PROPERTY_NAME_QUICKHASH1"],[0,5,1,"","PROPERTY_NAME_VENDOR"],[0,0,0,"-","deepzoom"],[0,6,1,"","open_slide"]],"openslide.OpenSlide":[[0,2,1,"","associated_images"],[0,3,1,"","close"],[0,2,1,"","color_profile"],[0,3,1,"","detect_format"],[0,2,1,"","dimensions"],[0,3,1,"","get_best_level_for_downsample"],[0,3,1,"","get_thumbnail"],[0,2,1,"","level_count"],[0,2,1,"","level_dimensions"],[0,2,1,"","level_downsamples"],[0,2,1,"","properties"],[0,3,1,"","read_region"],[0,3,1,"","set_cache"]],"openslide.deepzoom":[[0,1,1,"","DeepZoomGenerator"]],"openslide.deepzoom.DeepZoomGenerator":[[0,3,1,"","get_dzi"],[0,3,1,"","get_tile"],[0,3,1,"","get_tile_coordinates"],[0,3,1,"","get_tile_dimensions"],[0,2,1,"","level_count"],[0,2,1,"","level_dimensions"],[0,2,1,"","level_tiles"],[0,2,1,"","tile_count"]]},"objnames":{"0":["py","module","Python module"],"1":["py","class","Python class"],"2":["py","attribute","Python attribute"],"3":["py","method","Python method"],"4":["py","exception","Python exception"],"5":["py","data","Python data"],"6":["py","function","Python function"]},"objtypes":{"0":"py:module","1":"py:class","2":"py:attribute","3":"py:method","4":"py:exception","5":"py:data","6":"py:function"},"terms":{"A":0,"All":0,"An":0,"As":0,"By":0,"For":0,"If":0,"It":0,"Most":0,"On":0,"Or":0,"The":0,"Then":0,"These":0,"This":0,"To":0,"When":0,"You":0,"abil":0,"absent":0,"abstract":0,"abstractslid":0,"access":0,"add":0,"add_dll_directori":0,"addit":0,"address":0,"allow":0,"alreadi":0,"also":0,"amount":0,"anaconda":0,"ani":0,"aperio":0,"api":0,"applic":0,"applytransform":0,"apt":0,"argument":0,"around":0,"associ":0,"associated_imag":0,"attach":0,"attribut":0,"automat":0,"avail":0,"background":0,"base":0,"best":0,"bif":0,"bin":0,"binari":0,"bool":0,"bound":0,"browser":0,"build":0,"buildtransform":0,"byte":0,"bytesio":0,"c":0,"call":0,"can":0,"capac":0,"case":0,"class":0,"classmethod":0,"close":0,"closest":0,"color_profil":0,"column":0,"comfort":0,"comment":0,"common":0,"compat":0,"complet":0,"config":0,"conflict":0,"consid":0,"contain":0,"content":0,"context":0,"conveni":0,"convers":0,"convert":0,"coordin":0,"correspond":0,"count":0,"createprofil":0,"czi":0,"data":0,"dcm":0,"decod":0,"deepzoom":0,"deepzoom_multiserv":0,"deepzoom_serv":0,"deepzoom_til":0,"deepzoomgener":0,"default":0,"delet":0,"deliveri":0,"describ":0,"design":0,"desir":0,"detect_format":0,"dicom":0,"dictionari":0,"differ":0,"digit":0,"dimens":0,"directori":0,"disk":0,"display":0,"dnf":0,"doe":0,"download":0,"downsampl":0,"dzi":0,"easiest":0,"easili":0,"edg":0,"els":0,"embed":0,"empti":0,"entir":0,"error":0,"etc":0,"everi":0,"examin":0,"exit":0,"extra":0,"extract":0,"factor":0,"fail":0,"fals":0,"file":0,"filenam":0,"float":0,"form":0,"format":0,"former":0,"frame":0,"fromprofil":0,"function":0,"futur":0,"general":0,"generat":0,"generic":0,"get":0,"get_best_level_for_downsampl":0,"get_dzi":0,"get_thumbnail":0,"get_til":0,"get_tile_coordin":0,"get_tile_dimens":0,"getdefaultint":0,"getopenprofil":0,"gigabyt":0,"give":0,"given":0,"gnu":0,"hamamatsu":0,"hasattr":0,"height":0,"hex":0,"high":0,"highest":0,"html":0,"icc":0,"icc_profil":0,"identif":0,"imagecm":0,"imagecmsprofil":0,"imagecmstransform":0,"imageslid":0,"import":0,"includ":0,"index":0,"individu":0,"info":0,"insid":0,"instanc":0,"instead":0,"int":0,"intend":0,"intent":0,"interfac":0,"interior":0,"io":0,"jpeg":0,"k":0,"key":0,"known":0,"label":0,"latch":0,"left":0,"leica":0,"lesser":0,"level":0,"level_count":0,"level_dimens":0,"level_downsampl":0,"level_til":0,"librari":0,"licens":0,"limit_bound":0,"link":0,"linux":0,"list":0,"ll":0,"locat":0,"lowest":0,"maco":0,"macport":0,"macro":0,"map":0,"maximum":0,"may":0,"memori":0,"metadata":0,"micron":0,"mirax":0,"mix":0,"modul":0,"mrxs":0,"multi":0,"multipl":0,"must":0,"name":0,"ndpi":0,"need":0,"non":0,"none":0,"number":0,"occupi":0,"occur":0,"older":0,"onc":0,"one":0,"onli":0,"open":0,"open_slid":0,"openslide_path":0,"openslidecach":0,"openslideerror":0,"openslideunsupportedformaterror":0,"openslideversionerror":0,"oper":0,"option":0,"os":0,"oserror":0,"osr":0,"overlap":0,"packag":0,"page":0,"paramet":0,"pars":0,"particular":0,"path":0,"pathlik":0,"patholog":0,"per":0,"perform":0,"philip":0,"pil":0,"pip":0,"pixel":0,"pixels_i":0,"pixels_x":0,"plus":0,"png":0,"power":0,"premultipli":0,"privat":0,"process":0,"produc":0,"product":0,"profil":0,"profiletoprofil":0,"property_name_background_color":0,"property_name_bounds_height":0,"property_name_bounds_i":0,"property_name_bounds_width":0,"property_name_bounds_x":0,"property_name_com":0,"property_name_mpp_i":0,"property_name_mpp_x":0,"property_name_objective_pow":0,"property_name_quickhash1":0,"property_name_vendor":0,"provid":0,"public":0,"py":0,"pyramid":0,"quickhash":0,"r":0,"rais":0,"ram":0,"read":0,"read_region":0,"recent":0,"recogn":0,"rectangl":0,"refer":0,"region":0,"releas":0,"render":0,"repres":0,"request":0,"requir":0,"resolut":0,"return":0,"reus":0,"rgb":0,"rgba":0,"row":0,"s":0,"sakura":0,"save":0,"scn":0,"semant":0,"separ":0,"serv":0,"server":0,"set_cach":0,"sever":0,"similar":0,"simpl":0,"sinc":0,"singl":0,"size":0,"slide":0,"small":0,"sourc":0,"specifi":0,"srgb":0,"statement":0,"store":0,"str":0,"string":0,"subclass":0,"sum":0,"svs":0,"svslide":0,"synthes":0,"system":0,"ten":0,"term":0,"thumbnail":0,"tif":0,"tiff":0,"tile":0,"tile_count":0,"tile_s":0,"tiles_i":0,"tiles_x":0,"time":0,"tool":0,"top":0,"toprofil":0,"total":0,"transform":0,"tree":0,"trestl":0,"triplet":0,"true":0,"tupl":0,"two":0,"type":0,"typic":0,"uncompress":0,"underlying":0,"unlik":0,"upon":0,"use":0,"user":0,"valu":0,"vari":0,"vendor":0,"ventana":0,"version":0,"via":0,"view":0,"viewer":0,"vip":0,"virtual":0,"vms":0,"vmu":0,"way":0,"web":0,"whenev":0,"whole":0,"width":0,"will":0,"win64":0,"window":0,"within":0,"without":0,"wrapper":0,"x":0,"xml":0,"y":0,"zeiss":0,"zoomabl":0},"titles":["OpenSlide Python"],"titleterms":{"basic":0,"cach":0,"color":0,"deep":0,"exampl":0,"except":0,"imag":0,"instal":0,"manag":0,"object":0,"openslid":0,"pillow":0,"program":0,"properti":0,"python":0,"standard":0,"support":0,"usag":0,"wrap":0,"zoom":0}}) \ No newline at end of file diff --git a/api/python/static/base-stemmer.js b/api/python/static/base-stemmer.js new file mode 100644 index 0000000..e6fa0c4 --- /dev/null +++ b/api/python/static/base-stemmer.js @@ -0,0 +1,476 @@ +// @ts-check + +/**@constructor*/ +BaseStemmer = function() { + /** @protected */ + this.current = ''; + this.cursor = 0; + this.limit = 0; + this.limit_backward = 0; + this.bra = 0; + this.ket = 0; + + /** + * @param {string} value + */ + this.setCurrent = function(value) { + this.current = value; + this.cursor = 0; + this.limit = this.current.length; + this.limit_backward = 0; + this.bra = this.cursor; + this.ket = this.limit; + }; + + /** + * @return {string} + */ + this.getCurrent = function() { + return this.current; + }; + + /** + * @param {BaseStemmer} other + */ + this.copy_from = function(other) { + /** @protected */ + this.current = other.current; + this.cursor = other.cursor; + this.limit = other.limit; + this.limit_backward = other.limit_backward; + this.bra = other.bra; + this.ket = other.ket; + }; + + /** + * @param {number[]} s + * @param {number} min + * @param {number} max + * @return {boolean} + */ + this.in_grouping = function(s, min, max) { + /** @protected */ + if (this.cursor >= this.limit) return false; + var ch = this.current.charCodeAt(this.cursor); + if (ch > max || ch < min) return false; + ch -= min; + if ((s[ch >>> 3] & (0x1 << (ch & 0x7))) == 0) return false; + this.cursor++; + return true; + }; + + /** + * @param {number[]} s + * @param {number} min + * @param {number} max + * @return {boolean} + */ + this.go_in_grouping = function(s, min, max) { + /** @protected */ + while (this.cursor < this.limit) { + var ch = this.current.charCodeAt(this.cursor); + if (ch > max || ch < min) + return true; + ch -= min; + if ((s[ch >>> 3] & (0x1 << (ch & 0x7))) == 0) + return true; + this.cursor++; + } + return false; + }; + + /** + * @param {number[]} s + * @param {number} min + * @param {number} max + * @return {boolean} + */ + this.in_grouping_b = function(s, min, max) { + /** @protected */ + if (this.cursor <= this.limit_backward) return false; + var ch = this.current.charCodeAt(this.cursor - 1); + if (ch > max || ch < min) return false; + ch -= min; + if ((s[ch >>> 3] & (0x1 << (ch & 0x7))) == 0) return false; + this.cursor--; + return true; + }; + + /** + * @param {number[]} s + * @param {number} min + * @param {number} max + * @return {boolean} + */ + this.go_in_grouping_b = function(s, min, max) { + /** @protected */ + while (this.cursor > this.limit_backward) { + var ch = this.current.charCodeAt(this.cursor - 1); + if (ch > max || ch < min) return true; + ch -= min; + if ((s[ch >>> 3] & (0x1 << (ch & 0x7))) == 0) return true; + this.cursor--; + } + return false; + }; + + /** + * @param {number[]} s + * @param {number} min + * @param {number} max + * @return {boolean} + */ + this.out_grouping = function(s, min, max) { + /** @protected */ + if (this.cursor >= this.limit) return false; + var ch = this.current.charCodeAt(this.cursor); + if (ch > max || ch < min) { + this.cursor++; + return true; + } + ch -= min; + if ((s[ch >>> 3] & (0X1 << (ch & 0x7))) == 0) { + this.cursor++; + return true; + } + return false; + }; + + /** + * @param {number[]} s + * @param {number} min + * @param {number} max + * @return {boolean} + */ + this.go_out_grouping = function(s, min, max) { + /** @protected */ + while (this.cursor < this.limit) { + var ch = this.current.charCodeAt(this.cursor); + if (ch <= max && ch >= min) { + ch -= min; + if ((s[ch >>> 3] & (0X1 << (ch & 0x7))) != 0) { + return true; + } + } + this.cursor++; + } + return false; + }; + + /** + * @param {number[]} s + * @param {number} min + * @param {number} max + * @return {boolean} + */ + this.out_grouping_b = function(s, min, max) { + /** @protected */ + if (this.cursor <= this.limit_backward) return false; + var ch = this.current.charCodeAt(this.cursor - 1); + if (ch > max || ch < min) { + this.cursor--; + return true; + } + ch -= min; + if ((s[ch >>> 3] & (0x1 << (ch & 0x7))) == 0) { + this.cursor--; + return true; + } + return false; + }; + + /** + * @param {number[]} s + * @param {number} min + * @param {number} max + * @return {boolean} + */ + this.go_out_grouping_b = function(s, min, max) { + /** @protected */ + while (this.cursor > this.limit_backward) { + var ch = this.current.charCodeAt(this.cursor - 1); + if (ch <= max && ch >= min) { + ch -= min; + if ((s[ch >>> 3] & (0x1 << (ch & 0x7))) != 0) { + return true; + } + } + this.cursor--; + } + return false; + }; + + /** + * @param {string} s + * @return {boolean} + */ + this.eq_s = function(s) + { + /** @protected */ + if (this.limit - this.cursor < s.length) return false; + if (this.current.slice(this.cursor, this.cursor + s.length) != s) + { + return false; + } + this.cursor += s.length; + return true; + }; + + /** + * @param {string} s + * @return {boolean} + */ + this.eq_s_b = function(s) + { + /** @protected */ + if (this.cursor - this.limit_backward < s.length) return false; + if (this.current.slice(this.cursor - s.length, this.cursor) != s) + { + return false; + } + this.cursor -= s.length; + return true; + }; + + /** + * @param {Among[]} v + * @return {number} + */ + this.find_among = function(v) + { + /** @protected */ + var i = 0; + var j = v.length; + + var c = this.cursor; + var l = this.limit; + + var common_i = 0; + var common_j = 0; + + var first_key_inspected = false; + + while (true) + { + var k = i + ((j - i) >>> 1); + var diff = 0; + var common = common_i < common_j ? common_i : common_j; // smaller + // w[0]: string, w[1]: substring_i, w[2]: result, w[3]: function (optional) + var w = v[k]; + var i2; + for (i2 = common; i2 < w[0].length; i2++) + { + if (c + common == l) + { + diff = -1; + break; + } + diff = this.current.charCodeAt(c + common) - w[0].charCodeAt(i2); + if (diff != 0) break; + common++; + } + if (diff < 0) + { + j = k; + common_j = common; + } + else + { + i = k; + common_i = common; + } + if (j - i <= 1) + { + if (i > 0) break; // v->s has been inspected + if (j == i) break; // only one item in v + + // - but now we need to go round once more to get + // v->s inspected. This looks messy, but is actually + // the optimal approach. + + if (first_key_inspected) break; + first_key_inspected = true; + } + } + do { + var w = v[i]; + if (common_i >= w[0].length) + { + this.cursor = c + w[0].length; + if (w.length < 4) return w[2]; + var res = w[3](this); + this.cursor = c + w[0].length; + if (res) return w[2]; + } + i = w[1]; + } while (i >= 0); + return 0; + }; + + // find_among_b is for backwards processing. Same comments apply + /** + * @param {Among[]} v + * @return {number} + */ + this.find_among_b = function(v) + { + /** @protected */ + var i = 0; + var j = v.length + + var c = this.cursor; + var lb = this.limit_backward; + + var common_i = 0; + var common_j = 0; + + var first_key_inspected = false; + + while (true) + { + var k = i + ((j - i) >> 1); + var diff = 0; + var common = common_i < common_j ? common_i : common_j; + var w = v[k]; + var i2; + for (i2 = w[0].length - 1 - common; i2 >= 0; i2--) + { + if (c - common == lb) + { + diff = -1; + break; + } + diff = this.current.charCodeAt(c - 1 - common) - w[0].charCodeAt(i2); + if (diff != 0) break; + common++; + } + if (diff < 0) + { + j = k; + common_j = common; + } + else + { + i = k; + common_i = common; + } + if (j - i <= 1) + { + if (i > 0) break; + if (j == i) break; + if (first_key_inspected) break; + first_key_inspected = true; + } + } + do { + var w = v[i]; + if (common_i >= w[0].length) + { + this.cursor = c - w[0].length; + if (w.length < 4) return w[2]; + var res = w[3](this); + this.cursor = c - w[0].length; + if (res) return w[2]; + } + i = w[1]; + } while (i >= 0); + return 0; + }; + + /* to replace chars between c_bra and c_ket in this.current by the + * chars in s. + */ + /** + * @param {number} c_bra + * @param {number} c_ket + * @param {string} s + * @return {number} + */ + this.replace_s = function(c_bra, c_ket, s) + { + /** @protected */ + var adjustment = s.length - (c_ket - c_bra); + this.current = this.current.slice(0, c_bra) + s + this.current.slice(c_ket); + this.limit += adjustment; + if (this.cursor >= c_ket) this.cursor += adjustment; + else if (this.cursor > c_bra) this.cursor = c_bra; + return adjustment; + }; + + /** + * @return {boolean} + */ + this.slice_check = function() + { + /** @protected */ + if (this.bra < 0 || + this.bra > this.ket || + this.ket > this.limit || + this.limit > this.current.length) + { + return false; + } + return true; + }; + + /** + * @param {number} c_bra + * @return {boolean} + */ + this.slice_from = function(s) + { + /** @protected */ + var result = false; + if (this.slice_check()) + { + this.replace_s(this.bra, this.ket, s); + result = true; + } + return result; + }; + + /** + * @return {boolean} + */ + this.slice_del = function() + { + /** @protected */ + return this.slice_from(""); + }; + + /** + * @param {number} c_bra + * @param {number} c_ket + * @param {string} s + */ + this.insert = function(c_bra, c_ket, s) + { + /** @protected */ + var adjustment = this.replace_s(c_bra, c_ket, s); + if (c_bra <= this.bra) this.bra += adjustment; + if (c_bra <= this.ket) this.ket += adjustment; + }; + + /** + * @return {string} + */ + this.slice_to = function() + { + /** @protected */ + var result = ''; + if (this.slice_check()) + { + result = this.current.slice(this.bra, this.ket); + } + return result; + }; + + /** + * @return {string} + */ + this.assign_to = function() + { + /** @protected */ + return this.current.slice(0, this.limit); + }; +}; diff --git a/api/python/static/doctools.js b/api/python/static/doctools.js index 0398ebb..807cdb1 100644 --- a/api/python/static/doctools.js +++ b/api/python/static/doctools.js @@ -59,7 +59,7 @@ const Documentation = { Object.assign(Documentation.TRANSLATIONS, catalog.messages); Documentation.PLURAL_EXPR = new Function( "n", - `return (${catalog.plural_expr})` + `return (${catalog.plural_expr})`, ); Documentation.LOCALE = catalog.locale; }, @@ -89,7 +89,7 @@ const Documentation = { const togglerElements = document.querySelectorAll("img.toggler"); togglerElements.forEach((el) => - el.addEventListener("click", (event) => toggler(event.currentTarget)) + el.addEventListener("click", (event) => toggler(event.currentTarget)), ); togglerElements.forEach((el) => (el.style.display = "")); if (DOCUMENTATION_OPTIONS.COLLAPSE_INDEX) togglerElements.forEach(toggler); @@ -98,14 +98,15 @@ const Documentation = { initOnKeyListeners: () => { // only install a listener if it is really needed if ( - !DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS && - !DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS + !DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS + && !DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS ) return; document.addEventListener("keydown", (event) => { // bail for input elements - if (BLACKLISTED_KEY_CONTROL_ELEMENTS.has(document.activeElement.tagName)) return; + if (BLACKLISTED_KEY_CONTROL_ELEMENTS.has(document.activeElement.tagName)) + return; // bail with special keys if (event.altKey || event.ctrlKey || event.metaKey) return; diff --git a/api/python/static/documentation_options.js b/api/python/static/documentation_options.js index 6d656b6..4229cbf 100644 --- a/api/python/static/documentation_options.js +++ b/api/python/static/documentation_options.js @@ -1,5 +1,5 @@ const DOCUMENTATION_OPTIONS = { - VERSION: '1.4.2', + VERSION: '1.4.3', LANGUAGE: 'en', COLLAPSE_INDEX: false, BUILDER: 'html', diff --git a/api/python/static/english-stemmer.js b/api/python/static/english-stemmer.js new file mode 100644 index 0000000..056760e --- /dev/null +++ b/api/python/static/english-stemmer.js @@ -0,0 +1,1066 @@ +// Generated from english.sbl by Snowball 3.0.1 - https://snowballstem.org/ + +/**@constructor*/ +var EnglishStemmer = function() { + var base = new BaseStemmer(); + + /** @const */ var a_0 = [ + ["arsen", -1, -1], + ["commun", -1, -1], + ["emerg", -1, -1], + ["gener", -1, -1], + ["later", -1, -1], + ["organ", -1, -1], + ["past", -1, -1], + ["univers", -1, -1] + ]; + + /** @const */ var a_1 = [ + ["'", -1, 1], + ["'s'", 0, 1], + ["'s", -1, 1] + ]; + + /** @const */ var a_2 = [ + ["ied", -1, 2], + ["s", -1, 3], + ["ies", 1, 2], + ["sses", 1, 1], + ["ss", 1, -1], + ["us", 1, -1] + ]; + + /** @const */ var a_3 = [ + ["succ", -1, 1], + ["proc", -1, 1], + ["exc", -1, 1] + ]; + + /** @const */ var a_4 = [ + ["even", -1, 2], + ["cann", -1, 2], + ["inn", -1, 2], + ["earr", -1, 2], + ["herr", -1, 2], + ["out", -1, 2], + ["y", -1, 1] + ]; + + /** @const */ var a_5 = [ + ["", -1, -1], + ["ed", 0, 2], + ["eed", 1, 1], + ["ing", 0, 3], + ["edly", 0, 2], + ["eedly", 4, 1], + ["ingly", 0, 2] + ]; + + /** @const */ var a_6 = [ + ["", -1, 3], + ["bb", 0, 2], + ["dd", 0, 2], + ["ff", 0, 2], + ["gg", 0, 2], + ["bl", 0, 1], + ["mm", 0, 2], + ["nn", 0, 2], + ["pp", 0, 2], + ["rr", 0, 2], + ["at", 0, 1], + ["tt", 0, 2], + ["iz", 0, 1] + ]; + + /** @const */ var a_7 = [ + ["anci", -1, 3], + ["enci", -1, 2], + ["ogi", -1, 14], + ["li", -1, 16], + ["bli", 3, 12], + ["abli", 4, 4], + ["alli", 3, 8], + ["fulli", 3, 9], + ["lessli", 3, 15], + ["ousli", 3, 10], + ["entli", 3, 5], + ["aliti", -1, 8], + ["biliti", -1, 12], + ["iviti", -1, 11], + ["tional", -1, 1], + ["ational", 14, 7], + ["alism", -1, 8], + ["ation", -1, 7], + ["ization", 17, 6], + ["izer", -1, 6], + ["ator", -1, 7], + ["iveness", -1, 11], + ["fulness", -1, 9], + ["ousness", -1, 10], + ["ogist", -1, 13] + ]; + + /** @const */ var a_8 = [ + ["icate", -1, 4], + ["ative", -1, 6], + ["alize", -1, 3], + ["iciti", -1, 4], + ["ical", -1, 4], + ["tional", -1, 1], + ["ational", 5, 2], + ["ful", -1, 5], + ["ness", -1, 5] + ]; + + /** @const */ var a_9 = [ + ["ic", -1, 1], + ["ance", -1, 1], + ["ence", -1, 1], + ["able", -1, 1], + ["ible", -1, 1], + ["ate", -1, 1], + ["ive", -1, 1], + ["ize", -1, 1], + ["iti", -1, 1], + ["al", -1, 1], + ["ism", -1, 1], + ["ion", -1, 2], + ["er", -1, 1], + ["ous", -1, 1], + ["ant", -1, 1], + ["ent", -1, 1], + ["ment", 15, 1], + ["ement", 16, 1] + ]; + + /** @const */ var a_10 = [ + ["e", -1, 1], + ["l", -1, 2] + ]; + + /** @const */ var a_11 = [ + ["andes", -1, -1], + ["atlas", -1, -1], + ["bias", -1, -1], + ["cosmos", -1, -1], + ["early", -1, 5], + ["gently", -1, 3], + ["howe", -1, -1], + ["idly", -1, 2], + ["news", -1, -1], + ["only", -1, 6], + ["singly", -1, 7], + ["skies", -1, 1], + ["sky", -1, -1], + ["ugly", -1, 4] + ]; + + /** @const */ var /** Array */ g_aeo = [17, 64]; + + /** @const */ var /** Array */ g_v = [17, 65, 16, 1]; + + /** @const */ var /** Array */ g_v_WXY = [1, 17, 65, 208, 1]; + + /** @const */ var /** Array */ g_valid_LI = [55, 141, 2]; + + var /** boolean */ B_Y_found = false; + var /** number */ I_p2 = 0; + var /** number */ I_p1 = 0; + + + /** @return {boolean} */ + function r_prelude() { + B_Y_found = false; + /** @const */ var /** number */ v_1 = base.cursor; + lab0: { + base.bra = base.cursor; + if (!(base.eq_s("'"))) + { + break lab0; + } + base.ket = base.cursor; + if (!base.slice_del()) + { + return false; + } + } + base.cursor = v_1; + /** @const */ var /** number */ v_2 = base.cursor; + lab1: { + base.bra = base.cursor; + if (!(base.eq_s("y"))) + { + break lab1; + } + base.ket = base.cursor; + if (!base.slice_from("Y")) + { + return false; + } + B_Y_found = true; + } + base.cursor = v_2; + /** @const */ var /** number */ v_3 = base.cursor; + lab2: { + while(true) + { + /** @const */ var /** number */ v_4 = base.cursor; + lab3: { + golab4: while(true) + { + /** @const */ var /** number */ v_5 = base.cursor; + lab5: { + if (!(base.in_grouping(g_v, 97, 121))) + { + break lab5; + } + base.bra = base.cursor; + if (!(base.eq_s("y"))) + { + break lab5; + } + base.ket = base.cursor; + base.cursor = v_5; + break golab4; + } + base.cursor = v_5; + if (base.cursor >= base.limit) + { + break lab3; + } + base.cursor++; + } + if (!base.slice_from("Y")) + { + return false; + } + B_Y_found = true; + continue; + } + base.cursor = v_4; + break; + } + } + base.cursor = v_3; + return true; + }; + + /** @return {boolean} */ + function r_mark_regions() { + I_p1 = base.limit; + I_p2 = base.limit; + /** @const */ var /** number */ v_1 = base.cursor; + lab0: { + lab1: { + /** @const */ var /** number */ v_2 = base.cursor; + lab2: { + if (base.find_among(a_0) == 0) + { + break lab2; + } + break lab1; + } + base.cursor = v_2; + if (!base.go_out_grouping(g_v, 97, 121)) + { + break lab0; + } + base.cursor++; + if (!base.go_in_grouping(g_v, 97, 121)) + { + break lab0; + } + base.cursor++; + } + I_p1 = base.cursor; + if (!base.go_out_grouping(g_v, 97, 121)) + { + break lab0; + } + base.cursor++; + if (!base.go_in_grouping(g_v, 97, 121)) + { + break lab0; + } + base.cursor++; + I_p2 = base.cursor; + } + base.cursor = v_1; + return true; + }; + + /** @return {boolean} */ + function r_shortv() { + lab0: { + /** @const */ var /** number */ v_1 = base.limit - base.cursor; + lab1: { + if (!(base.out_grouping_b(g_v_WXY, 89, 121))) + { + break lab1; + } + if (!(base.in_grouping_b(g_v, 97, 121))) + { + break lab1; + } + if (!(base.out_grouping_b(g_v, 97, 121))) + { + break lab1; + } + break lab0; + } + base.cursor = base.limit - v_1; + lab2: { + if (!(base.out_grouping_b(g_v, 97, 121))) + { + break lab2; + } + if (!(base.in_grouping_b(g_v, 97, 121))) + { + break lab2; + } + if (base.cursor > base.limit_backward) + { + break lab2; + } + break lab0; + } + base.cursor = base.limit - v_1; + if (!(base.eq_s_b("past"))) + { + return false; + } + } + return true; + }; + + /** @return {boolean} */ + function r_R1() { + return I_p1 <= base.cursor; + }; + + /** @return {boolean} */ + function r_R2() { + return I_p2 <= base.cursor; + }; + + /** @return {boolean} */ + function r_Step_1a() { + var /** number */ among_var; + /** @const */ var /** number */ v_1 = base.limit - base.cursor; + lab0: { + base.ket = base.cursor; + if (base.find_among_b(a_1) == 0) + { + base.cursor = base.limit - v_1; + break lab0; + } + base.bra = base.cursor; + if (!base.slice_del()) + { + return false; + } + } + base.ket = base.cursor; + among_var = base.find_among_b(a_2); + if (among_var == 0) + { + return false; + } + base.bra = base.cursor; + switch (among_var) { + case 1: + if (!base.slice_from("ss")) + { + return false; + } + break; + case 2: + lab1: { + /** @const */ var /** number */ v_2 = base.limit - base.cursor; + lab2: { + { + /** @const */ var /** number */ c1 = base.cursor - 2; + if (c1 < base.limit_backward) + { + break lab2; + } + base.cursor = c1; + } + if (!base.slice_from("i")) + { + return false; + } + break lab1; + } + base.cursor = base.limit - v_2; + if (!base.slice_from("ie")) + { + return false; + } + } + break; + case 3: + if (base.cursor <= base.limit_backward) + { + return false; + } + base.cursor--; + if (!base.go_out_grouping_b(g_v, 97, 121)) + { + return false; + } + base.cursor--; + if (!base.slice_del()) + { + return false; + } + break; + } + return true; + }; + + /** @return {boolean} */ + function r_Step_1b() { + var /** number */ among_var; + base.ket = base.cursor; + among_var = base.find_among_b(a_5); + base.bra = base.cursor; + lab0: { + /** @const */ var /** number */ v_1 = base.limit - base.cursor; + lab1: { + switch (among_var) { + case 1: + /** @const */ var /** number */ v_2 = base.limit - base.cursor; + lab2: { + lab3: { + /** @const */ var /** number */ v_3 = base.limit - base.cursor; + lab4: { + if (base.find_among_b(a_3) == 0) + { + break lab4; + } + if (base.cursor > base.limit_backward) + { + break lab4; + } + break lab3; + } + base.cursor = base.limit - v_3; + if (!r_R1()) + { + break lab2; + } + if (!base.slice_from("ee")) + { + return false; + } + } + } + base.cursor = base.limit - v_2; + break; + case 2: + break lab1; + case 3: + among_var = base.find_among_b(a_4); + if (among_var == 0) + { + break lab1; + } + switch (among_var) { + case 1: + /** @const */ var /** number */ v_4 = base.limit - base.cursor; + if (!(base.out_grouping_b(g_v, 97, 121))) + { + break lab1; + } + if (base.cursor > base.limit_backward) + { + break lab1; + } + base.cursor = base.limit - v_4; + base.bra = base.cursor; + if (!base.slice_from("ie")) + { + return false; + } + break; + case 2: + if (base.cursor > base.limit_backward) + { + break lab1; + } + break; + } + break; + } + break lab0; + } + base.cursor = base.limit - v_1; + /** @const */ var /** number */ v_5 = base.limit - base.cursor; + if (!base.go_out_grouping_b(g_v, 97, 121)) + { + return false; + } + base.cursor--; + base.cursor = base.limit - v_5; + if (!base.slice_del()) + { + return false; + } + base.ket = base.cursor; + base.bra = base.cursor; + /** @const */ var /** number */ v_6 = base.limit - base.cursor; + among_var = base.find_among_b(a_6); + switch (among_var) { + case 1: + if (!base.slice_from("e")) + { + return false; + } + return false; + case 2: + { + /** @const */ var /** number */ v_7 = base.limit - base.cursor; + lab5: { + if (!(base.in_grouping_b(g_aeo, 97, 111))) + { + break lab5; + } + if (base.cursor > base.limit_backward) + { + break lab5; + } + return false; + } + base.cursor = base.limit - v_7; + } + break; + case 3: + if (base.cursor != I_p1) + { + return false; + } + /** @const */ var /** number */ v_8 = base.limit - base.cursor; + if (!r_shortv()) + { + return false; + } + base.cursor = base.limit - v_8; + if (!base.slice_from("e")) + { + return false; + } + return false; + } + base.cursor = base.limit - v_6; + base.ket = base.cursor; + if (base.cursor <= base.limit_backward) + { + return false; + } + base.cursor--; + base.bra = base.cursor; + if (!base.slice_del()) + { + return false; + } + } + return true; + }; + + /** @return {boolean} */ + function r_Step_1c() { + base.ket = base.cursor; + lab0: { + /** @const */ var /** number */ v_1 = base.limit - base.cursor; + lab1: { + if (!(base.eq_s_b("y"))) + { + break lab1; + } + break lab0; + } + base.cursor = base.limit - v_1; + if (!(base.eq_s_b("Y"))) + { + return false; + } + } + base.bra = base.cursor; + if (!(base.out_grouping_b(g_v, 97, 121))) + { + return false; + } + lab2: { + if (base.cursor > base.limit_backward) + { + break lab2; + } + return false; + } + if (!base.slice_from("i")) + { + return false; + } + return true; + }; + + /** @return {boolean} */ + function r_Step_2() { + var /** number */ among_var; + base.ket = base.cursor; + among_var = base.find_among_b(a_7); + if (among_var == 0) + { + return false; + } + base.bra = base.cursor; + if (!r_R1()) + { + return false; + } + switch (among_var) { + case 1: + if (!base.slice_from("tion")) + { + return false; + } + break; + case 2: + if (!base.slice_from("ence")) + { + return false; + } + break; + case 3: + if (!base.slice_from("ance")) + { + return false; + } + break; + case 4: + if (!base.slice_from("able")) + { + return false; + } + break; + case 5: + if (!base.slice_from("ent")) + { + return false; + } + break; + case 6: + if (!base.slice_from("ize")) + { + return false; + } + break; + case 7: + if (!base.slice_from("ate")) + { + return false; + } + break; + case 8: + if (!base.slice_from("al")) + { + return false; + } + break; + case 9: + if (!base.slice_from("ful")) + { + return false; + } + break; + case 10: + if (!base.slice_from("ous")) + { + return false; + } + break; + case 11: + if (!base.slice_from("ive")) + { + return false; + } + break; + case 12: + if (!base.slice_from("ble")) + { + return false; + } + break; + case 13: + if (!base.slice_from("og")) + { + return false; + } + break; + case 14: + if (!(base.eq_s_b("l"))) + { + return false; + } + if (!base.slice_from("og")) + { + return false; + } + break; + case 15: + if (!base.slice_from("less")) + { + return false; + } + break; + case 16: + if (!(base.in_grouping_b(g_valid_LI, 99, 116))) + { + return false; + } + if (!base.slice_del()) + { + return false; + } + break; + } + return true; + }; + + /** @return {boolean} */ + function r_Step_3() { + var /** number */ among_var; + base.ket = base.cursor; + among_var = base.find_among_b(a_8); + if (among_var == 0) + { + return false; + } + base.bra = base.cursor; + if (!r_R1()) + { + return false; + } + switch (among_var) { + case 1: + if (!base.slice_from("tion")) + { + return false; + } + break; + case 2: + if (!base.slice_from("ate")) + { + return false; + } + break; + case 3: + if (!base.slice_from("al")) + { + return false; + } + break; + case 4: + if (!base.slice_from("ic")) + { + return false; + } + break; + case 5: + if (!base.slice_del()) + { + return false; + } + break; + case 6: + if (!r_R2()) + { + return false; + } + if (!base.slice_del()) + { + return false; + } + break; + } + return true; + }; + + /** @return {boolean} */ + function r_Step_4() { + var /** number */ among_var; + base.ket = base.cursor; + among_var = base.find_among_b(a_9); + if (among_var == 0) + { + return false; + } + base.bra = base.cursor; + if (!r_R2()) + { + return false; + } + switch (among_var) { + case 1: + if (!base.slice_del()) + { + return false; + } + break; + case 2: + lab0: { + /** @const */ var /** number */ v_1 = base.limit - base.cursor; + lab1: { + if (!(base.eq_s_b("s"))) + { + break lab1; + } + break lab0; + } + base.cursor = base.limit - v_1; + if (!(base.eq_s_b("t"))) + { + return false; + } + } + if (!base.slice_del()) + { + return false; + } + break; + } + return true; + }; + + /** @return {boolean} */ + function r_Step_5() { + var /** number */ among_var; + base.ket = base.cursor; + among_var = base.find_among_b(a_10); + if (among_var == 0) + { + return false; + } + base.bra = base.cursor; + switch (among_var) { + case 1: + lab0: { + lab1: { + if (!r_R2()) + { + break lab1; + } + break lab0; + } + if (!r_R1()) + { + return false; + } + { + /** @const */ var /** number */ v_1 = base.limit - base.cursor; + lab2: { + if (!r_shortv()) + { + break lab2; + } + return false; + } + base.cursor = base.limit - v_1; + } + } + if (!base.slice_del()) + { + return false; + } + break; + case 2: + if (!r_R2()) + { + return false; + } + if (!(base.eq_s_b("l"))) + { + return false; + } + if (!base.slice_del()) + { + return false; + } + break; + } + return true; + }; + + /** @return {boolean} */ + function r_exception1() { + var /** number */ among_var; + base.bra = base.cursor; + among_var = base.find_among(a_11); + if (among_var == 0) + { + return false; + } + base.ket = base.cursor; + if (base.cursor < base.limit) + { + return false; + } + switch (among_var) { + case 1: + if (!base.slice_from("sky")) + { + return false; + } + break; + case 2: + if (!base.slice_from("idl")) + { + return false; + } + break; + case 3: + if (!base.slice_from("gentl")) + { + return false; + } + break; + case 4: + if (!base.slice_from("ugli")) + { + return false; + } + break; + case 5: + if (!base.slice_from("earli")) + { + return false; + } + break; + case 6: + if (!base.slice_from("onli")) + { + return false; + } + break; + case 7: + if (!base.slice_from("singl")) + { + return false; + } + break; + } + return true; + }; + + /** @return {boolean} */ + function r_postlude() { + if (!B_Y_found) + { + return false; + } + while(true) + { + /** @const */ var /** number */ v_1 = base.cursor; + lab0: { + golab1: while(true) + { + /** @const */ var /** number */ v_2 = base.cursor; + lab2: { + base.bra = base.cursor; + if (!(base.eq_s("Y"))) + { + break lab2; + } + base.ket = base.cursor; + base.cursor = v_2; + break golab1; + } + base.cursor = v_2; + if (base.cursor >= base.limit) + { + break lab0; + } + base.cursor++; + } + if (!base.slice_from("y")) + { + return false; + } + continue; + } + base.cursor = v_1; + break; + } + return true; + }; + + this.stem = /** @return {boolean} */ function() { + lab0: { + /** @const */ var /** number */ v_1 = base.cursor; + lab1: { + if (!r_exception1()) + { + break lab1; + } + break lab0; + } + base.cursor = v_1; + lab2: { + { + /** @const */ var /** number */ v_2 = base.cursor; + lab3: { + { + /** @const */ var /** number */ c1 = base.cursor + 3; + if (c1 > base.limit) + { + break lab3; + } + base.cursor = c1; + } + break lab2; + } + base.cursor = v_2; + } + break lab0; + } + base.cursor = v_1; + r_prelude(); + r_mark_regions(); + base.limit_backward = base.cursor; base.cursor = base.limit; + /** @const */ var /** number */ v_3 = base.limit - base.cursor; + r_Step_1a(); + base.cursor = base.limit - v_3; + /** @const */ var /** number */ v_4 = base.limit - base.cursor; + r_Step_1b(); + base.cursor = base.limit - v_4; + /** @const */ var /** number */ v_5 = base.limit - base.cursor; + r_Step_1c(); + base.cursor = base.limit - v_5; + /** @const */ var /** number */ v_6 = base.limit - base.cursor; + r_Step_2(); + base.cursor = base.limit - v_6; + /** @const */ var /** number */ v_7 = base.limit - base.cursor; + r_Step_3(); + base.cursor = base.limit - v_7; + /** @const */ var /** number */ v_8 = base.limit - base.cursor; + r_Step_4(); + base.cursor = base.limit - v_8; + /** @const */ var /** number */ v_9 = base.limit - base.cursor; + r_Step_5(); + base.cursor = base.limit - v_9; + base.cursor = base.limit_backward; + /** @const */ var /** number */ v_10 = base.cursor; + r_postlude(); + base.cursor = v_10; + } + return true; + }; + + /**@return{string}*/ + this['stemWord'] = function(/**string*/word) { + base.setCurrent(word); + this.stem(); + return base.getCurrent(); + }; +}; diff --git a/api/python/static/language_data.js b/api/python/static/language_data.js index c7fe6c6..5776786 100644 --- a/api/python/static/language_data.js +++ b/api/python/static/language_data.js @@ -1,192 +1,13 @@ /* * This script contains the language-specific data used by searchtools.js, - * namely the list of stopwords, stemmer, scorer and splitter. + * namely the set of stopwords, stemmer, scorer and splitter. */ -var stopwords = ["a", "and", "are", "as", "at", "be", "but", "by", "for", "if", "in", "into", "is", "it", "near", "no", "not", "of", "on", "or", "such", "that", "the", "their", "then", "there", "these", "they", "this", "to", "was", "will", "with"]; +const stopwords = new Set(["a", "about", "above", "after", "again", "against", "all", "am", "an", "and", "any", "are", "aren't", "as", "at", "be", "because", "been", "before", "being", "below", "between", "both", "but", "by", "can't", "cannot", "could", "couldn't", "did", "didn't", "do", "does", "doesn't", "doing", "don't", "down", "during", "each", "few", "for", "from", "further", "had", "hadn't", "has", "hasn't", "have", "haven't", "having", "he", "he'd", "he'll", "he's", "her", "here", "here's", "hers", "herself", "him", "himself", "his", "how", "how's", "i", "i'd", "i'll", "i'm", "i've", "if", "in", "into", "is", "isn't", "it", "it's", "its", "itself", "let's", "me", "more", "most", "mustn't", "my", "myself", "no", "nor", "not", "of", "off", "on", "once", "only", "or", "other", "ought", "our", "ours", "ourselves", "out", "over", "own", "same", "shan't", "she", "she'd", "she'll", "she's", "should", "shouldn't", "so", "some", "such", "than", "that", "that's", "the", "their", "theirs", "them", "themselves", "then", "there", "there's", "these", "they", "they'd", "they'll", "they're", "they've", "this", "those", "through", "to", "too", "under", "until", "up", "very", "was", "wasn't", "we", "we'd", "we'll", "we're", "we've", "were", "weren't", "what", "what's", "when", "when's", "where", "where's", "which", "while", "who", "who's", "whom", "why", "why's", "with", "won't", "would", "wouldn't", "you", "you'd", "you'll", "you're", "you've", "your", "yours", "yourself", "yourselves"]); +window.stopwords = stopwords; // Export to global scope -/* Non-minified version is copied as a separate JS file, if available */ - -/** - * Porter Stemmer - */ -var Stemmer = function() { - - var step2list = { - ational: 'ate', - tional: 'tion', - enci: 'ence', - anci: 'ance', - izer: 'ize', - bli: 'ble', - alli: 'al', - entli: 'ent', - eli: 'e', - ousli: 'ous', - ization: 'ize', - ation: 'ate', - ator: 'ate', - alism: 'al', - iveness: 'ive', - fulness: 'ful', - ousness: 'ous', - aliti: 'al', - iviti: 'ive', - biliti: 'ble', - logi: 'log' - }; - - var step3list = { - icate: 'ic', - ative: '', - alize: 'al', - iciti: 'ic', - ical: 'ic', - ful: '', - ness: '' - }; - - var c = "[^aeiou]"; // consonant - var v = "[aeiouy]"; // vowel - var C = c + "[^aeiouy]*"; // consonant sequence - var V = v + "[aeiou]*"; // vowel sequence - - var mgr0 = "^(" + C + ")?" + V + C; // [C]VC... is m>0 - var meq1 = "^(" + C + ")?" + V + C + "(" + V + ")?$"; // [C]VC[V] is m=1 - var mgr1 = "^(" + C + ")?" + V + C + V + C; // [C]VCVC... is m>1 - var s_v = "^(" + C + ")?" + v; // vowel in stem - - this.stemWord = function (w) { - var stem; - var suffix; - var firstch; - var origword = w; - - if (w.length < 3) - return w; - - var re; - var re2; - var re3; - var re4; - - firstch = w.substr(0,1); - if (firstch == "y") - w = firstch.toUpperCase() + w.substr(1); - - // Step 1a - re = /^(.+?)(ss|i)es$/; - re2 = /^(.+?)([^s])s$/; - - if (re.test(w)) - w = w.replace(re,"$1$2"); - else if (re2.test(w)) - w = w.replace(re2,"$1$2"); - - // Step 1b - re = /^(.+?)eed$/; - re2 = /^(.+?)(ed|ing)$/; - if (re.test(w)) { - var fp = re.exec(w); - re = new RegExp(mgr0); - if (re.test(fp[1])) { - re = /.$/; - w = w.replace(re,""); - } - } - else if (re2.test(w)) { - var fp = re2.exec(w); - stem = fp[1]; - re2 = new RegExp(s_v); - if (re2.test(stem)) { - w = stem; - re2 = /(at|bl|iz)$/; - re3 = new RegExp("([^aeiouylsz])\\1$"); - re4 = new RegExp("^" + C + v + "[^aeiouwxy]$"); - if (re2.test(w)) - w = w + "e"; - else if (re3.test(w)) { - re = /.$/; - w = w.replace(re,""); - } - else if (re4.test(w)) - w = w + "e"; - } - } - - // Step 1c - re = /^(.+?)y$/; - if (re.test(w)) { - var fp = re.exec(w); - stem = fp[1]; - re = new RegExp(s_v); - if (re.test(stem)) - w = stem + "i"; - } - - // Step 2 - re = /^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/; - if (re.test(w)) { - var fp = re.exec(w); - stem = fp[1]; - suffix = fp[2]; - re = new RegExp(mgr0); - if (re.test(stem)) - w = stem + step2list[suffix]; - } - - // Step 3 - re = /^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/; - if (re.test(w)) { - var fp = re.exec(w); - stem = fp[1]; - suffix = fp[2]; - re = new RegExp(mgr0); - if (re.test(stem)) - w = stem + step3list[suffix]; - } - - // Step 4 - re = /^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/; - re2 = /^(.+?)(s|t)(ion)$/; - if (re.test(w)) { - var fp = re.exec(w); - stem = fp[1]; - re = new RegExp(mgr1); - if (re.test(stem)) - w = stem; - } - else if (re2.test(w)) { - var fp = re2.exec(w); - stem = fp[1] + fp[2]; - re2 = new RegExp(mgr1); - if (re2.test(stem)) - w = stem; - } - - // Step 5 - re = /^(.+?)e$/; - if (re.test(w)) { - var fp = re.exec(w); - stem = fp[1]; - re = new RegExp(mgr1); - re2 = new RegExp(meq1); - re3 = new RegExp("^" + C + v + "[^aeiouwxy]$"); - if (re.test(stem) || (re2.test(stem) && !(re3.test(stem)))) - w = stem; - } - re = /ll$/; - re2 = new RegExp(mgr1); - if (re.test(w) && re2.test(w)) { - re = /.$/; - w = w.replace(re,""); - } - - // and turn initial Y back to y - if (firstch == "y") - w = firstch.toLowerCase() + w.substr(1); - return w; - } -} - +/* Non-minified versions are copied as separate JavaScript files, if available */ +BaseStemmer=function(){this.current="",this.cursor=0,this.limit=0,this.limit_backward=0,this.bra=0,this.ket=0,this.setCurrent=function(t){this.current=t,this.cursor=0,this.limit=this.current.length,this.limit_backward=0,this.bra=this.cursor,this.ket=this.limit},this.getCurrent=function(){return this.current},this.copy_from=function(t){this.current=t.current,this.cursor=t.cursor,this.limit=t.limit,this.limit_backward=t.limit_backward,this.bra=t.bra,this.ket=t.ket},this.in_grouping=function(t,r,i){return!(this.cursor>=this.limit||i<(i=this.current.charCodeAt(this.cursor))||i>>3]&1<<(7&i))||(this.cursor++,0))},this.go_in_grouping=function(t,r,i){for(;this.cursor>>3]&1<<(7&s)))return!0;this.cursor++}return!1},this.in_grouping_b=function(t,r,i){return!(this.cursor<=this.limit_backward||i<(i=this.current.charCodeAt(this.cursor-1))||i>>3]&1<<(7&i))||(this.cursor--,0))},this.go_in_grouping_b=function(t,r,i){for(;this.cursor>this.limit_backward;){var s=this.current.charCodeAt(this.cursor-1);if(i>>3]&1<<(7&s)))return!0;this.cursor--}return!1},this.out_grouping=function(t,r,i){return!(this.cursor>=this.limit)&&(i<(i=this.current.charCodeAt(this.cursor))||i>>3]&1<<(7&i)))&&(this.cursor++,!0)},this.go_out_grouping=function(t,r,i){for(;this.cursor>>3]&1<<(7&s)))return!0;this.cursor++}return!1},this.out_grouping_b=function(t,r,i){return!(this.cursor<=this.limit_backward)&&(i<(i=this.current.charCodeAt(this.cursor-1))||i>>3]&1<<(7&i)))&&(this.cursor--,!0)},this.go_out_grouping_b=function(t,r,i){for(;this.cursor>this.limit_backward;){var s=this.current.charCodeAt(this.cursor-1);if(s<=i&&r<=s&&0!=(t[(s-=r)>>>3]&1<<(7&s)))return!0;this.cursor--}return!1},this.eq_s=function(t){return!(this.limit-this.cursor>>1),o=0,a=e=(l=t[r])[0].length){if(this.cursor=s+l[0].length,l.length<4)return l[2];var g=l[3](this);if(this.cursor=s+l[0].length,g)return l[2]}}while(0<=(r=l[1]));return 0},this.find_among_b=function(t){for(var r=0,i=t.length,s=this.cursor,h=this.limit_backward,e=0,n=0,c=!1;;){for(var u,o=r+(i-r>>1),a=0,l=e=(u=t[r])[0].length){if(this.cursor=s-u[0].length,u.length<4)return u[2];var g=u[3](this);if(this.cursor=s-u[0].length,g)return u[2]}}while(0<=(r=u[1]));return 0},this.replace_s=function(t,r,i){var s=i.length-(r-t);return this.current=this.current.slice(0,t)+i+this.current.slice(r),this.limit+=s,this.cursor>=r?this.cursor+=s:this.cursor>t&&(this.cursor=t),s},this.slice_check=function(){return!(this.bra<0||this.bra>this.ket||this.ket>this.limit||this.limit>this.current.length)},this.slice_from=function(t){var r=!1;return this.slice_check()&&(this.replace_s(this.bra,this.ket,t),r=!0),r},this.slice_del=function(){return this.slice_from("")},this.insert=function(t,r,i){r=this.replace_s(t,r,i);t<=this.bra&&(this.bra+=r),t<=this.ket&&(this.ket+=r)},this.slice_to=function(){var t="";return t=this.slice_check()?this.current.slice(this.bra,this.ket):t},this.assign_to=function(){return this.current.slice(0,this.limit)}}; +var EnglishStemmer=function(){var a=new BaseStemmer,c=[["arsen",-1,-1],["commun",-1,-1],["emerg",-1,-1],["gener",-1,-1],["later",-1,-1],["organ",-1,-1],["past",-1,-1],["univers",-1,-1]],o=[["'",-1,1],["'s'",0,1],["'s",-1,1]],u=[["ied",-1,2],["s",-1,3],["ies",1,2],["sses",1,1],["ss",1,-1],["us",1,-1]],t=[["succ",-1,1],["proc",-1,1],["exc",-1,1]],l=[["even",-1,2],["cann",-1,2],["inn",-1,2],["earr",-1,2],["herr",-1,2],["out",-1,2],["y",-1,1]],n=[["",-1,-1],["ed",0,2],["eed",1,1],["ing",0,3],["edly",0,2],["eedly",4,1],["ingly",0,2]],f=[["",-1,3],["bb",0,2],["dd",0,2],["ff",0,2],["gg",0,2],["bl",0,1],["mm",0,2],["nn",0,2],["pp",0,2],["rr",0,2],["at",0,1],["tt",0,2],["iz",0,1]],_=[["anci",-1,3],["enci",-1,2],["ogi",-1,14],["li",-1,16],["bli",3,12],["abli",4,4],["alli",3,8],["fulli",3,9],["lessli",3,15],["ousli",3,10],["entli",3,5],["aliti",-1,8],["biliti",-1,12],["iviti",-1,11],["tional",-1,1],["ational",14,7],["alism",-1,8],["ation",-1,7],["ization",17,6],["izer",-1,6],["ator",-1,7],["iveness",-1,11],["fulness",-1,9],["ousness",-1,10],["ogist",-1,13]],m=[["icate",-1,4],["ative",-1,6],["alize",-1,3],["iciti",-1,4],["ical",-1,4],["tional",-1,1],["ational",5,2],["ful",-1,5],["ness",-1,5]],b=[["ic",-1,1],["ance",-1,1],["ence",-1,1],["able",-1,1],["ible",-1,1],["ate",-1,1],["ive",-1,1],["ize",-1,1],["iti",-1,1],["al",-1,1],["ism",-1,1],["ion",-1,2],["er",-1,1],["ous",-1,1],["ant",-1,1],["ent",-1,1],["ment",15,1],["ement",16,1]],k=[["e",-1,1],["l",-1,2]],g=[["andes",-1,-1],["atlas",-1,-1],["bias",-1,-1],["cosmos",-1,-1],["early",-1,5],["gently",-1,3],["howe",-1,-1],["idly",-1,2],["news",-1,-1],["only",-1,6],["singly",-1,7],["skies",-1,1],["sky",-1,-1],["ugly",-1,4]],d=[17,64],v=[17,65,16,1],i=[1,17,65,208,1],w=[55,141,2],p=!1,y=0,h=0;function q(){var r=a.limit-a.cursor;return!!(a.out_grouping_b(i,89,121)&&a.in_grouping_b(v,97,121)&&a.out_grouping_b(v,97,121)||(a.cursor=a.limit-r,a.out_grouping_b(v,97,121)&&a.in_grouping_b(v,97,121)&&!(a.cursor>a.limit_backward))||(a.cursor=a.limit-r,a.eq_s_b("past")))}function z(){return h<=a.cursor}function Y(){return y<=a.cursor}this.stem=function(){var r=a.cursor;if(!(()=>{var r;if(a.bra=a.cursor,0!=(r=a.find_among(g))&&(a.ket=a.cursor,!(a.cursora.limit)a.cursor=i;else{a.cursor=e,a.cursor=r,(()=>{p=!1;var r=a.cursor;if(a.bra=a.cursor,!a.eq_s("'")||(a.ket=a.cursor,a.slice_del())){a.cursor=r;r=a.cursor;if(a.bra=a.cursor,a.eq_s("y")){if(a.ket=a.cursor,!a.slice_from("Y"))return;p=!0}a.cursor=r;for(r=a.cursor;;){var i=a.cursor;r:{for(;;){var e=a.cursor;if(a.in_grouping(v,97,121)&&(a.bra=a.cursor,a.eq_s("y"))){a.ket=a.cursor,a.cursor=e;break}if(a.cursor=e,a.cursor>=a.limit)break r;a.cursor++}if(!a.slice_from("Y"))return;p=!0;continue}a.cursor=i;break}a.cursor=r}})(),h=a.limit,y=a.limit;i=a.cursor;r:{var s=a.cursor;if(0==a.find_among(c)){if(a.cursor=s,!a.go_out_grouping(v,97,121))break r;if(a.cursor++,!a.go_in_grouping(v,97,121))break r;a.cursor++}h=a.cursor,a.go_out_grouping(v,97,121)&&(a.cursor++,a.go_in_grouping(v,97,121))&&(a.cursor++,y=a.cursor)}a.cursor=i,a.limit_backward=a.cursor,a.cursor=a.limit;var e=a.limit-a.cursor,r=((()=>{var r=a.limit-a.cursor;if(a.ket=a.cursor,0==a.find_among_b(o))a.cursor=a.limit-r;else if(a.bra=a.cursor,!a.slice_del())return;if(a.ket=a.cursor,0!=(r=a.find_among_b(u)))switch(a.bra=a.cursor,r){case 1:if(a.slice_from("ss"))break;return;case 2:r:{var i=a.limit-a.cursor,e=a.cursor-2;if(!(e{a.ket=a.cursor,o=a.find_among_b(n),a.bra=a.cursor;r:{var r=a.limit-a.cursor;i:{switch(o){case 1:var i=a.limit-a.cursor;e:{var e=a.limit-a.cursor;if(0==a.find_among_b(t)||a.cursor>a.limit_backward){if(a.cursor=a.limit-e,!z())break e;if(!a.slice_from("ee"))return}}a.cursor=a.limit-i;break;case 2:break i;case 3:if(0==(o=a.find_among_b(l)))break i;switch(o){case 1:var s=a.limit-a.cursor;if(!a.out_grouping_b(v,97,121))break i;if(a.cursor>a.limit_backward)break i;if(a.cursor=a.limit-s,a.bra=a.cursor,a.slice_from("ie"))break;return;case 2:if(a.cursor>a.limit_backward)break i}}break r}a.cursor=a.limit-r;var c=a.limit-a.cursor;if(!a.go_out_grouping_b(v,97,121))return;if(a.cursor--,a.cursor=a.limit-c,!a.slice_del())return;a.ket=a.cursor,a.bra=a.cursor;var o,c=a.limit-a.cursor;switch(o=a.find_among_b(f)){case 1:return a.slice_from("e");case 2:var u=a.limit-a.cursor;if(a.in_grouping_b(d,97,111)&&!(a.cursor>a.limit_backward))return;a.cursor=a.limit-u;break;case 3:return a.cursor!=h||(u=a.limit-a.cursor,q()&&(a.cursor=a.limit-u,a.slice_from("e")))}if(a.cursor=a.limit-c,a.ket=a.cursor,a.cursor<=a.limit_backward)return;if(a.cursor--,a.bra=a.cursor,!a.slice_del())return}})(),a.cursor=a.limit-r,a.limit-a.cursor),r=(a.ket=a.cursor,e=a.limit-a.cursor,(a.eq_s_b("y")||(a.cursor=a.limit-e,a.eq_s_b("Y")))&&(a.bra=a.cursor,a.out_grouping_b(v,97,121))&&a.cursor>a.limit_backward&&a.slice_from("i"),a.cursor=a.limit-i,a.limit-a.cursor),e=((()=>{var r;if(a.ket=a.cursor,0!=(r=a.find_among_b(_))&&(a.bra=a.cursor,z()))switch(r){case 1:if(a.slice_from("tion"))break;return;case 2:if(a.slice_from("ence"))break;return;case 3:if(a.slice_from("ance"))break;return;case 4:if(a.slice_from("able"))break;return;case 5:if(a.slice_from("ent"))break;return;case 6:if(a.slice_from("ize"))break;return;case 7:if(a.slice_from("ate"))break;return;case 8:if(a.slice_from("al"))break;return;case 9:if(a.slice_from("ful"))break;return;case 10:if(a.slice_from("ous"))break;return;case 11:if(a.slice_from("ive"))break;return;case 12:if(a.slice_from("ble"))break;return;case 13:if(a.slice_from("og"))break;return;case 14:if(!a.eq_s_b("l"))return;if(a.slice_from("og"))break;return;case 15:if(a.slice_from("less"))break;return;case 16:if(!a.in_grouping_b(w,99,116))return;if(a.slice_del())break}})(),a.cursor=a.limit-r,a.limit-a.cursor),i=((()=>{var r;if(a.ket=a.cursor,0!=(r=a.find_among_b(m))&&(a.bra=a.cursor,z()))switch(r){case 1:if(a.slice_from("tion"))break;return;case 2:if(a.slice_from("ate"))break;return;case 3:if(a.slice_from("al"))break;return;case 4:if(a.slice_from("ic"))break;return;case 5:if(a.slice_del())break;return;case 6:if(!Y())return;if(a.slice_del())break}})(),a.cursor=a.limit-e,a.limit-a.cursor),r=((()=>{var r;if(a.ket=a.cursor,0!=(r=a.find_among_b(b))&&(a.bra=a.cursor,Y()))switch(r){case 1:if(a.slice_del())break;return;case 2:var i=a.limit-a.cursor;if(!a.eq_s_b("s")&&(a.cursor=a.limit-i,!a.eq_s_b("t")))return;if(a.slice_del())break}})(),a.cursor=a.limit-i,a.limit-a.cursor),e=((()=>{var r;if(a.ket=a.cursor,0!=(r=a.find_among_b(k)))switch(a.bra=a.cursor,r){case 1:if(!Y()){if(!z())return;var i=a.limit-a.cursor;if(q())return;a.cursor=a.limit-i}if(a.slice_del())break;return;case 2:if(!Y())return;if(!a.eq_s_b("l"))return;if(a.slice_del())break}})(),a.cursor=a.limit-r,a.cursor=a.limit_backward,a.cursor);(()=>{if(p)for(;;){var r=a.cursor;r:{for(;;){var i=a.cursor;if(a.bra=a.cursor,a.eq_s("Y")){a.ket=a.cursor,a.cursor=i;break}if(a.cursor=i,a.cursor>=a.limit)break r;a.cursor++}if(a.slice_from("y"))continue;return}a.cursor=r;break}})(),a.cursor=e}}return!0},this.stemWord=function(r){return a.setCurrent(r),this.stem(),a.getCurrent()}}; +window.Stemmer = EnglishStemmer; diff --git a/api/python/static/searchtools.js b/api/python/static/searchtools.js index 91f4be5..e29b1c7 100644 --- a/api/python/static/searchtools.js +++ b/api/python/static/searchtools.js @@ -41,11 +41,12 @@ if (typeof Scorer === "undefined") { } // Global search result kind enum, used by themes to style search results. +// prettier-ignore class SearchResultKind { - static get index() { return "index"; } - static get object() { return "object"; } - static get text() { return "text"; } - static get title() { return "title"; } + static get index() { return "index"; } + static get object() { return "object"; } + static get text() { return "text"; } + static get title() { return "title"; } } const _removeChildren = (element) => { @@ -58,6 +59,15 @@ const _removeChildren = (element) => { const _escapeRegExp = (string) => string.replace(/[.*+\-?^${}()|[\]\\]/g, "\\$&"); // $& means the whole matched string +const _escapeHTML = (text) => { + return text + .replaceAll("&", "&") + .replaceAll("<", "<") + .replaceAll(">", ">") + .replaceAll('"', """) + .replaceAll("'", "'"); +}; + const _displayItem = (item, searchTerms, highlightTerms) => { const docBuilder = DOCUMENTATION_OPTIONS.BUILDER; const docFileSuffix = DOCUMENTATION_OPTIONS.FILE_SUFFIX; @@ -90,25 +100,30 @@ const _displayItem = (item, searchTerms, highlightTerms) => { let linkEl = listItem.appendChild(document.createElement("a")); linkEl.href = linkUrl + anchor; linkEl.dataset.score = score; - linkEl.innerHTML = title; + linkEl.innerHTML = _escapeHTML(title); if (descr) { listItem.appendChild(document.createElement("span")).innerHTML = - " (" + descr + ")"; + ` (${_escapeHTML(descr)})`; // highlight search terms in the description - if (SPHINX_HIGHLIGHT_ENABLED) // set in sphinx_highlight.js - highlightTerms.forEach((term) => _highlightText(listItem, term, "highlighted")); - } - else if (showSearchSummary) + if (SPHINX_HIGHLIGHT_ENABLED) + // SPHINX_HIGHLIGHT_ENABLED is set in sphinx_highlight.js + highlightTerms.forEach((term) => + _highlightText(listItem, term, "highlighted"), + ); + } else if (showSearchSummary) fetch(requestUrl) .then((responseData) => responseData.text()) .then((data) => { if (data) listItem.appendChild( - Search.makeSearchSummary(data, searchTerms, anchor) + Search.makeSearchSummary(data, searchTerms, anchor), ); // highlight search terms in the summary - if (SPHINX_HIGHLIGHT_ENABLED) // set in sphinx_highlight.js - highlightTerms.forEach((term) => _highlightText(listItem, term, "highlighted")); + if (SPHINX_HIGHLIGHT_ENABLED) + // SPHINX_HIGHLIGHT_ENABLED is set in sphinx_highlight.js + highlightTerms.forEach((term) => + _highlightText(listItem, term, "highlighted"), + ); }); Search.output.appendChild(listItem); }; @@ -117,14 +132,14 @@ const _finishSearch = (resultCount) => { Search.title.innerText = _("Search Results"); if (!resultCount) Search.status.innerText = Documentation.gettext( - "Your search did not match any documents. Please make sure that all words are spelled correctly and that you've selected enough categories." + "Your search did not match any documents. Please make sure that all words are spelled correctly and that you've selected enough categories.", ); else Search.status.innerText = Documentation.ngettext( "Search finished, found one page matching the search query.", "Search finished, found ${resultCount} pages matching the search query.", resultCount, - ).replace('${resultCount}', resultCount); + ).replace("${resultCount}", resultCount); }; const _displayNextItem = ( results, @@ -138,7 +153,7 @@ const _displayNextItem = ( _displayItem(results.pop(), searchTerms, highlightTerms); setTimeout( () => _displayNextItem(results, resultCount, searchTerms, highlightTerms), - 5 + 5, ); } // search finished, update title and status message @@ -170,9 +185,10 @@ const _orderResultsByScoreThenName = (a, b) => { * This is the same as ``\W+`` in Python, preserving the surrogate pair area. */ if (typeof splitQuery === "undefined") { - var splitQuery = (query) => query + var splitQuery = (query) => + query .split(/[^\p{Letter}\p{Number}_\p{Emoji_Presentation}]+/gu) - .filter(term => term) // remove remaining empty strings + .filter((term) => term); // remove remaining empty strings } /** @@ -184,16 +200,23 @@ const Search = { _pulse_status: -1, htmlToText: (htmlString, anchor) => { - const htmlElement = new DOMParser().parseFromString(htmlString, 'text/html'); + const htmlElement = new DOMParser().parseFromString( + htmlString, + "text/html", + ); for (const removalQuery of [".headerlink", "script", "style"]) { - htmlElement.querySelectorAll(removalQuery).forEach((el) => { el.remove() }); + htmlElement.querySelectorAll(removalQuery).forEach((el) => { + el.remove(); + }); } if (anchor) { - const anchorContent = htmlElement.querySelector(`[role="main"] ${anchor}`); + const anchorContent = htmlElement.querySelector( + `[role="main"] ${anchor}`, + ); if (anchorContent) return anchorContent.textContent; console.warn( - `Anchored content block not found. Sphinx search tries to obtain it via DOM query '[role=main] ${anchor}'. Check your theme or template.` + `Anchored content block not found. Sphinx search tries to obtain it via DOM query '[role=main] ${anchor}'. Check your theme or template.`, ); } @@ -202,7 +225,7 @@ const Search = { if (docContent) return docContent.textContent; console.warn( - "Content block not found. Sphinx search tries to obtain it via DOM query '[role=main]'. Check your theme or template." + "Content block not found. Sphinx search tries to obtain it via DOM query '[role=main]'. Check your theme or template.", ); return ""; }, @@ -287,12 +310,8 @@ const Search = { const queryTermLower = queryTerm.toLowerCase(); // maybe skip this "word" - // stopwords array is from language_data.js - if ( - stopwords.indexOf(queryTermLower) !== -1 || - queryTerm.match(/^\d+$/) - ) - return; + // stopwords set is from language_data.js + if (stopwords.has(queryTermLower) || queryTerm.match(/^\d+$/)) return; // stem the word let word = stemmer.stemWord(queryTermLower); @@ -304,8 +323,12 @@ const Search = { } }); - if (SPHINX_HIGHLIGHT_ENABLED) { // set in sphinx_highlight.js - localStorage.setItem("sphinx_highlight_terms", [...highlightTerms].join(" ")) + if (SPHINX_HIGHLIGHT_ENABLED) { + // SPHINX_HIGHLIGHT_ENABLED is set in sphinx_highlight.js + localStorage.setItem( + "sphinx_highlight_terms", + [...highlightTerms].join(" "), + ); } // console.debug("SEARCH: searching for:"); @@ -318,7 +341,13 @@ const Search = { /** * execute search (requires search index to be loaded) */ - _performSearch: (query, searchTerms, excludedTerms, highlightTerms, objectTerms) => { + _performSearch: ( + query, + searchTerms, + excludedTerms, + highlightTerms, + objectTerms, + ) => { const filenames = Search._index.filenames; const docNames = Search._index.docnames; const titles = Search._index.titles; @@ -334,10 +363,15 @@ const Search = { const queryLower = query.toLowerCase().trim(); for (const [title, foundTitles] of Object.entries(allTitles)) { - if (title.toLowerCase().trim().includes(queryLower) && (queryLower.length >= title.length/2)) { + if ( + title.toLowerCase().trim().includes(queryLower) + && queryLower.length >= title.length / 2 + ) { for (const [file, id] of foundTitles) { - const score = Math.round(Scorer.title * queryLower.length / title.length); - const boost = titles[file] === title ? 1 : 0; // add a boost for document titles + const score = Math.round( + (Scorer.title * queryLower.length) / title.length, + ); + const boost = titles[file] === title ? 1 : 0; // add a boost for document titles normalResults.push([ docNames[file], titles[file] !== title ? `${titles[file]} > ${title}` : title, @@ -353,9 +387,9 @@ const Search = { // search for explicit entries in index directives for (const [entry, foundEntries] of Object.entries(indexEntries)) { - if (entry.includes(queryLower) && (queryLower.length >= entry.length/2)) { + if (entry.includes(queryLower) && queryLower.length >= entry.length / 2) { for (const [file, id, isMain] of foundEntries) { - const score = Math.round(100 * queryLower.length / entry.length); + const score = Math.round((100 * queryLower.length) / entry.length); const result = [ docNames[file], titles[file], @@ -376,11 +410,13 @@ const Search = { // lookup as object objectTerms.forEach((term) => - normalResults.push(...Search.performObjectSearch(term, objectTerms)) + normalResults.push(...Search.performObjectSearch(term, objectTerms)), ); // lookup as search terms in fulltext - normalResults.push(...Search.performTermsSearch(searchTerms, excludedTerms)); + normalResults.push( + ...Search.performTermsSearch(searchTerms, excludedTerms), + ); // let the scorer override scores with a custom scoring function if (Scorer.score) { @@ -401,7 +437,11 @@ const Search = { // note the reversing of results, so that in the case of duplicates, the highest-scoring entry is kept let seen = new Set(); results = results.reverse().reduce((acc, result) => { - let resultStr = result.slice(0, 4).concat([result[5]]).map(v => String(v)).join(','); + let resultStr = result + .slice(0, 4) + .concat([result[5]]) + .map((v) => String(v)) + .join(","); if (!seen.has(resultStr)) { acc.push(result); seen.add(resultStr); @@ -413,8 +453,20 @@ const Search = { }, query: (query) => { - const [searchQuery, searchTerms, excludedTerms, highlightTerms, objectTerms] = Search._parseQuery(query); - const results = Search._performSearch(searchQuery, searchTerms, excludedTerms, highlightTerms, objectTerms); + const [ + searchQuery, + searchTerms, + excludedTerms, + highlightTerms, + objectTerms, + ] = Search._parseQuery(query); + const results = Search._performSearch( + searchQuery, + searchTerms, + excludedTerms, + highlightTerms, + objectTerms, + ); // for debugging //Search.lastresults = results.slice(); // a copy @@ -437,7 +489,7 @@ const Search = { const results = []; const objectSearchCallback = (prefix, match) => { - const name = match[4] + const name = match[4]; const fullname = (prefix ? prefix + "." : "") + name; const fullnameLower = fullname.toLowerCase(); if (fullnameLower.indexOf(object) < 0) return; @@ -489,9 +541,7 @@ const Search = { ]); }; Object.keys(objects).forEach((prefix) => - objects[prefix].forEach((array) => - objectSearchCallback(prefix, array) - ) + objects[prefix].forEach((array) => objectSearchCallback(prefix, array)), ); return results; }, @@ -516,8 +566,14 @@ const Search = { // find documents, if any, containing the query word in their text/title term indices // use Object.hasOwnProperty to avoid mismatching against prototype properties const arr = [ - { files: terms.hasOwnProperty(word) ? terms[word] : undefined, score: Scorer.term }, - { files: titleTerms.hasOwnProperty(word) ? titleTerms[word] : undefined, score: Scorer.title }, + { + files: terms.hasOwnProperty(word) ? terms[word] : undefined, + score: Scorer.term, + }, + { + files: titleTerms.hasOwnProperty(word) ? titleTerms[word] : undefined, + score: Scorer.title, + }, ]; // add support for partial matches if (word.length > 2) { @@ -558,7 +614,8 @@ const Search = { // create the mapping files.forEach((file) => { if (!fileMap.has(file)) fileMap.set(file, [word]); - else if (fileMap.get(file).indexOf(word) === -1) fileMap.get(file).push(word); + else if (fileMap.get(file).indexOf(word) === -1) + fileMap.get(file).push(word); }); }); @@ -569,11 +626,11 @@ const Search = { // as search terms with length < 3 are discarded const filteredTermCount = [...searchTerms].filter( - (term) => term.length > 2 + (term) => term.length > 2, ).length; if ( - wordList.length !== searchTerms.size && - wordList.length !== filteredTermCount + wordList.length !== searchTerms.size + && wordList.length !== filteredTermCount ) continue; @@ -581,10 +638,10 @@ const Search = { if ( [...excludedTerms].some( (term) => - terms[term] === file || - titleTerms[term] === file || - (terms[term] || []).includes(file) || - (titleTerms[term] || []).includes(file) + terms[term] === file + || titleTerms[term] === file + || (terms[term] || []).includes(file) + || (titleTerms[term] || []).includes(file), ) ) break; @@ -626,7 +683,8 @@ const Search = { let summary = document.createElement("p"); summary.classList.add("context"); - summary.textContent = top + text.substr(startWithContext, 240).trim() + tail; + summary.textContent = + top + text.substr(startWithContext, 240).trim() + tail; return summary; }, diff --git a/api/python/static/sphinx_highlight.js b/api/python/static/sphinx_highlight.js index 8a96c69..a74e103 100644 --- a/api/python/static/sphinx_highlight.js +++ b/api/python/static/sphinx_highlight.js @@ -1,7 +1,7 @@ /* Highlighting utilities for Sphinx HTML documentation. */ "use strict"; -const SPHINX_HIGHLIGHT_ENABLED = true +const SPHINX_HIGHLIGHT_ENABLED = true; /** * highlight a given string on a node by wrapping it in @@ -13,9 +13,9 @@ const _highlight = (node, addItems, text, className) => { const parent = node.parentNode; const pos = val.toLowerCase().indexOf(text); if ( - pos >= 0 && - !parent.classList.contains(className) && - !parent.classList.contains("nohighlight") + pos >= 0 + && !parent.classList.contains(className) + && !parent.classList.contains("nohighlight") ) { let span; @@ -30,13 +30,7 @@ const _highlight = (node, addItems, text, className) => { span.appendChild(document.createTextNode(val.substr(pos, text.length))); const rest = document.createTextNode(val.substr(pos + text.length)); - parent.insertBefore( - span, - parent.insertBefore( - rest, - node.nextSibling - ) - ); + parent.insertBefore(span, parent.insertBefore(rest, node.nextSibling)); node.nodeValue = val.substr(0, pos); /* There may be more occurrences of search term in this node. So call this * function recursively on the remaining fragment. @@ -46,7 +40,7 @@ const _highlight = (node, addItems, text, className) => { if (isInSVG) { const rect = document.createElementNS( "http://www.w3.org/2000/svg", - "rect" + "rect", ); const bbox = parent.getBBox(); rect.x.baseVal.value = bbox.x; @@ -65,7 +59,7 @@ const _highlightText = (thisNode, text, className) => { let addItems = []; _highlight(thisNode, addItems, text, className); addItems.forEach((obj) => - obj.parent.insertAdjacentElement("beforebegin", obj.target) + obj.parent.insertAdjacentElement("beforebegin", obj.target), ); }; @@ -73,25 +67,31 @@ const _highlightText = (thisNode, text, className) => { * Small JavaScript module for the documentation. */ const SphinxHighlight = { - /** * highlight the search words provided in localstorage in the text */ highlightSearchWords: () => { - if (!SPHINX_HIGHLIGHT_ENABLED) return; // bail if no highlight + if (!SPHINX_HIGHLIGHT_ENABLED) return; // bail if no highlight // get and clear terms from localstorage const url = new URL(window.location); const highlight = - localStorage.getItem("sphinx_highlight_terms") - || url.searchParams.get("highlight") - || ""; - localStorage.removeItem("sphinx_highlight_terms") - url.searchParams.delete("highlight"); - window.history.replaceState({}, "", url); + localStorage.getItem("sphinx_highlight_terms") + || url.searchParams.get("highlight") + || ""; + localStorage.removeItem("sphinx_highlight_terms"); + // Update history only if '?highlight' is present; otherwise it + // clears text fragments (not set in window.location by the browser) + if (url.searchParams.has("highlight")) { + url.searchParams.delete("highlight"); + window.history.replaceState({}, "", url); + } // get individual terms from highlight string - const terms = highlight.toLowerCase().split(/\s+/).filter(x => x); + const terms = highlight + .toLowerCase() + .split(/\s+/) + .filter((x) => x); if (terms.length === 0) return; // nothing to do // There should never be more than one element matching "div.body" @@ -107,11 +107,11 @@ const SphinxHighlight = { document .createRange() .createContextualFragment( - '" - ) + '", + ), ); }, @@ -125,7 +125,7 @@ const SphinxHighlight = { document .querySelectorAll("span.highlighted") .forEach((el) => el.classList.remove("highlighted")); - localStorage.removeItem("sphinx_highlight_terms") + localStorage.removeItem("sphinx_highlight_terms"); }, initEscapeListener: () => { @@ -134,10 +134,15 @@ const SphinxHighlight = { document.addEventListener("keydown", (event) => { // bail for input elements - if (BLACKLISTED_KEY_CONTROL_ELEMENTS.has(document.activeElement.tagName)) return; + if (BLACKLISTED_KEY_CONTROL_ELEMENTS.has(document.activeElement.tagName)) + return; // bail with special keys - if (event.shiftKey || event.altKey || event.ctrlKey || event.metaKey) return; - if (DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS && (event.key === "Escape")) { + if (event.shiftKey || event.altKey || event.ctrlKey || event.metaKey) + return; + if ( + DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS + && event.key === "Escape" + ) { SphinxHighlight.hideSearchWords(); event.preventDefault(); } diff --git a/download/index.md b/download/index.md index 5a7686a..5e88723 100644 --- a/download/index.md +++ b/download/index.md @@ -251,7 +251,7 @@ openslide/[~4] PyPI
      - On RHEL 8 (with Python 3.8+) or Ubuntu 20.04:
      + On RHEL 8 (with Python 3.9+):
      python3 -m pip install --upgrade pip
      python3 -m pip install openslide-bin