Table of Contents

AI-Powered Keyword Extraction for .NET Applications


🎯 Purpose of the Sample

This Keyword Extraction Demo demonstrates how to leverage the LM-Kit.NET SDK to identify and extract the most relevant keywords or key phrases from various text sources. This capability is useful in scenarios such as large-scale content analysis, search optimization, topic identification, and enhanced content curation. By deploying LM-Kit's high-performance, on-device keyword extraction technology, developers can quickly and accurately filter through extensive documents to surface critical insights.

The demo uses the KeywordExtraction class, which provides a simple, high-level API for extracting top keywords. It also harnesses LM-Kit's Dynamic Sampling technology to achieve fast, accurate results, even on smaller models.


πŸ‘₯ Industry Target Audience

The Keyword Extraction sample is especially valuable for developers and organizations working in fields that need rapid insight into large textual datasets:

  • πŸ“‘ Content Management: Automatically uncover key topics in articles, reports, and other unstructured text, improving categorization and indexing.
  • πŸ” Search & Discovery: Enhance internal search engines, knowledge bases, and question-answering systems with more focused keyword filters.
  • πŸ“Š Market & Competitive Intelligence: Quickly identify recurring themes in news articles, research reports, or social media feeds.
  • πŸ‘¨β€πŸ’Ό Human Resources & Recruiting: Identify major skill keywords from candidate resumes, job descriptions, and HR documents.
  • πŸ›οΈ Legal & Compliance: Pinpoint essential legal terms or clauses in large collections of contracts and regulatory documents.
  • πŸ“ˆ Analytics & Business Intelligence: Distill large textual datasets into actionable insights, guiding data-driven decision-making.

πŸš€ Problem Solved

Manually sifting through large volumes of text to identify key topics and terms is both time-consuming and prone to human error. By using LM-Kit’s on-device keyword extraction, this demo streamlines the process, automatically surfacing critical keywords with speed and accuracy. Whether you need to quickly understand main themes in a large report, enhance the relevance of search queries, or inform downstream analytics and recommendations, this solution drastically reduces overhead and increases reliability.


πŸ’» Sample Application Description

The Keyword Extraction Demo is a console application that allows users to input a text file containing a passage of interest. The application then runs the LM-Kit keyword extraction engine on the text, identifying and returning the top keywords. This entire process is facilitated by the KeywordExtraction class, simplifying the logic required and offering a high-level API to configure parameters like the number of keywords to extract.

The result is a concise list of keywords that capture the essence of the document, which can then be used in search optimization, content summarization, recommendation systems, or any scenario where understanding the main topics quickly is valuable.

✨ Key Features

  • 🧠 Model Flexibility: Choose from multiple pre-trained models or specify custom ones.
  • πŸ“„ Wide Application: Efficiently extract key terms from any text sourceβ€”articles, documents, reports, emails, etc.
  • πŸ”— High-Level API: Simplified integration using the KeywordExtraction class.
  • ⚑ Dynamic Sampling: Utilizes Dynamic Sampling technology for quick, accurate keyword results.
  • 🧩 On-Device Efficiency: No external services needed, ensuring privacy and reduced latency.

🧠 Supported Models

This sample supports the same set of pre-trained models as other LM-Kit samples, including:

  • Mistral Nemo 2407 12.2B
  • Meta Llama 3.1 8B
  • Google Gemma2 9B Medium
  • Microsoft Phi-3 3.82B Mini
  • Alibaba Qwen-2 7.6B
  • Additional smaller models or custom model URIs as desired

πŸ› οΈ Getting Started

πŸ“‹ Prerequisites

  • .NET Framework 4.6.2 or .NET 6.0

πŸ“₯ Download the Project

▢️ Running the Application

  1. πŸ“‚ Clone the repository:

    git clone https://github.com/LM-Kit/lm-kit-net-samples.git
    
  2. πŸ“ Navigate to the project directory:

    cd lm-kit-net-samples/console_net6/keyword_extraction
    

    or

    cd lm-kit-net-samples/console_framework_4.62/keyword_extraction
    
  3. πŸ”¨ Build and run the application:

    dotnet build
    dotnet run
    

πŸ’‘ Example Usage

  1. Set the License Key (if available):

    LMKit.Licensing.LicenseManager.SetLicenseKey(""); // Set an optional license key if available.
    
  2. Select the Model: Upon running, the application will prompt you to select from the pre-defined models or input a custom model URI.

  3. Provide the Input Text File: The application will request the path to a text file from which to extract keywords. For example:

    Please enter the path to the text file containing your input:
    > path/to/your/textfile.txt
    
  4. View the Extracted Keywords: After processing, the application will display the top extracted keywords along with timing and confidence metrics:

    Extracted elements:
    keyword1
    keyword2
    ...
    Extraction done in X.XX seconds | Confidence: YY
    

By following these steps, developers can effortlessly experiment with keyword extraction on their own data, rapidly identifying main topics and key phrases. This streamlined approach to keyword identification can be integrated into various workflows, ranging from search enhancement and topic discovery to providing more personalized user experiences.