From the course: Rust LLMOps

Unlock this course with a free trial

Join today to access over 24,700 courses taught by industry experts.

Rust sentiment analysis in the CLI

Rust sentiment analysis in the CLI - Rust Tutorial

From the course: Rust LLMOps

Rust sentiment analysis in the CLI

- Here we have Rust-Burt. It's a Rust-native State-of-the-Art NLP Model and Pipeline tool. It's a port of hugging face. You can see that you can do sentiment analysis quite easily. Now, if I want to do this inside of a CLI, that's one of the best ways to take advantage of these hugging face models. And I can use clap here. So we say use clap parser, build out some arguments, and then just execute it inside of a main function. So really simple to build a binary that you can actually distribute to the rest of your team or potentially to a client that you're working with. So if we go over to this example here, what I did is I put together based on the example from the Rust Burt examples, how to classify sentiment. So I tweaked it a little bit and let's walk through what I tweaked. So first up in here I say I want to pass in an input because I know later that I'm going to have clap, parse this from the command line. And then what I do here is I say, let's actually convert that input into…

Contents