Class NamedEntityUtility


  • public class NamedEntityUtility
    extends java.lang.Object
    Provides functionality for working with Nuix named entities.
    • Constructor Detail

      • NamedEntityUtility

        public NamedEntityUtility()
    • Method Detail

      • whenProgressUpdated

        public void whenProgressUpdated​(NamedEntityRedactionProgressCallback callback)
        Registers callback for when this instance signals it has made progress.
        Parameters:
        callback - Invoked when this instance signals it has made progress.
      • whenMessageGenerated

        public void whenMessageGenerated​(java.util.function.Consumer<java.lang.String> callback)
        Registers callback for when this instance logs a message.
        Parameters:
        callback - Invoked when this instance logs a message.
      • recordRedactedCopies

        public NamedEntityRedactionResults recordRedactedCopies​(nuix.Item item,
                                                                NamedEntityRedactionSettings settings)
                                                         throws java.lang.Exception
        Creates redacted copies of metadata properties and item content text by performing find and replace operations by finding named entity matches in the values and replacing them with redaction text. Find and replace is performed using Pattern objects crafted by taking named entity match strings, escaping them into regex literals and then running find replace against each property or item text. Redactions are then recorded as custom metadata fields back to the item. See NamedEntityRedactionSettings for a list of settings you can configure to determine how this process is performed.
        Parameters:
        item - The item to process
        settings - The settings to use while processing the item.
        Returns:
        Results object which contains some information about how things went.
        Throws:
        java.lang.Exception - Thrown is something unexpectedly goes wrong.
      • recordRedactedCopies

        public NamedEntityRedactionResults recordRedactedCopies​(java.util.Collection<nuix.Item> items,
                                                                NamedEntityRedactionSettings settings)
        Creates redacted copies of metadata properties and item content text by performing find and replace operations by finding named entity matches in the values and replacing them with redaction text. This method processes multiple items by repeated calls to recordRedactedCopies(Item, NamedEntityRedactionSettings).
        Parameters:
        items - The items to process
        settings - The settings to use when processing the items
        Returns:
        Results object which contains some information about how things went. Is a combination of the results generated for each individual item.
      • recordRedactedCopies

        public NamedEntityRedactionResults recordRedactedCopies​(nuix.Case nuixCase,
                                                                NamedEntityRedactionSettings settings)
                                                         throws java.lang.Exception
        Creates redacted copies of metadata properties and item content text by performing find and replace operations by finding named entity matches in the values and replacing them with redaction text. This method locates items in the specified case based on the list of named entities specified in the NamedEntityRedactionSettings object provided. Once those items are obtained, this method calls recordRedactedCopies(Collection, NamedEntityRedactionSettings).
        Parameters:
        nuixCase - The Nuix case from which items will be obtained.
        settings - The settings used to process the obtained items.
        Returns:
        Results object which contains some information about how things went. Is a combination of the results generated for each individual item.
        Throws:
        java.lang.Exception - Thrown if something goes wrong running the search to obtain the items to process.
      • recordRedactedCopies

        public NamedEntityRedactionResults recordRedactedCopies​(nuix.Case nuixCase,
                                                                java.util.Collection<nuix.Item> arbitraryItems,
                                                                NamedEntityRedactionSettings settings)
                                                         throws java.lang.Exception
        Creates redacted copies of metadata properties and item content text by performing find and replace operations by finding named entity matches in the values and replacing them with redaction text. This method method accepts an arbitrary collection of items which are filtered to only items with the relevant named entities as specified by recordRedactedCopies(Collection, NamedEntityRedactionSettings). Items with appropriate named entities is determined by first running a search for items with those named entities, as provided by QueryHelper.namedEntityQuery(Collection). The hits of that query are then intersected against the arbitrary collection of items provided to produce the filtered collection of items which is then provided as an argument in an internal call to recordRedactedCopies(Collection, NamedEntityRedactionSettings).
        Parameters:
        nuixCase - The Nuix case used to obtain collection of items with relevant named entities
        arbitraryItems - A collection of items (likely from user selection) from which only items with relevant named entities will be pulled
        settings - The settings used to process the items.
        Returns:
        Results object which contains some information about how things went. Is a combination of the results generated for each individual item.
        Throws:
        java.lang.Exception - Thrown if something goes wrong running the search to obtain the items to process.
      • saveRedactionProfile

        public static void saveRedactionProfile​(java.io.File destination,
                                                NamedEntityRedactionResults redactionResults,
                                                NamedEntityRedactionSettings settings)
                                         throws java.lang.Exception
        Builds and saves to a file a Nuix metadata profile containing fields 'Name' and 'Position' as well as a series of derived fields that use "first-non-blank" to coalesce a redacted field and the based original field.
        Parameters:
        destination - Where the profile should be saved to.
        redactionResults - Results from a redaction run, used to determine which redacted fields need to be in the profile.
        settings - Settings used in a redaction run, used mostly to determine prefix used for custom metadata fields.
        Throws:
        java.lang.Exception - Thrown if something goes wrong unexpectedly.
      • saveRedactionProfile

        public static void saveRedactionProfile​(java.lang.String destination,
                                                NamedEntityRedactionResults redactionResults,
                                                NamedEntityRedactionSettings settings)
                                         throws java.lang.Exception
        Builds and saves to a file a Nuix metadata profile containing fields 'Name' and 'Position' as well as a series of derived fields that use "first-non-blank" to coalesce a redacted field and the based original field.
        Parameters:
        destination - Where the profile should be saved to.
        redactionResults - Results from a redaction run, used to determine which redacted fields need to be in the profile.
        settings - Settings used in a redaction run, used mostly to determine prefix used for custom metadata fields.
        Throws:
        java.lang.Exception - Thrown if something goes wrong unexpectedly.