GithubHelp home page GithubHelp logo

spacy-sentences's Introduction

Spacy Wrapper for Go

This project is a Go wrapper for the spacy-cpp library, allowing you to use spaCy's NLP capabilities in your Go applications.

Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/spacy-wrapper.git
    cd spacy-wrapper
  2. Build the spacy-cpp library:

    cd spacy-cpp
    mkdir -p build && cd build
    cmake ..
    make
    sudo make install
  3. Set the LD_LIBRARY_PATH environment variable:

      export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
  4. Build the Go project:

      go build -o spacy_app
      cd ../..
  5. Run the Go application:

    ./spacy_app

Usage

package main

import (
	"fmt"
	"log"
	"spacy/spacy"
)

func main() {
	nlp, err := spacy.LoadModel("en_core_web_sm")
	if err != nil {
		log.Fatalf("Error loading model: %v", err)
	}
	defer nlp.Free()

	text := "This is a test. This is another sentence."
	doc, err := nlp.Parse(text)
	if err != nil {
		log.Fatalf("Error parsing text: %v", err)
	}
	defer doc.Free()

	sentences, err := doc.GetSentences()
	if err != nil {
		log.Fatalf("Error getting sentences: %v", err)
	}

	for i, sentence := range sentences {
		fmt.Printf("Sentence %d: %s\n", i+1, sentence)
	}
}

License

This project is licensed under the MIT License.

spacy-sentences's People

Contributors

am-sokolov avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.