# Text

## Introduction

Fluxtion supports processing of text streams using the extension module [fu-text](https://github.com/v12technology/fluxtion/tree/master/extensions/fu-text). Text streams may be received from an external publisher like a news outlet or from a local document like a csv file. Each stream is deconstructed into a set of [CharEvent](https://github.com/v12technology/fluxtion/blob/master/extensions/fu-text/api/src/main/java/com/fluxtion/ext/futext/api/event/CharEvent.java) and [EofEvent](https://github.com/v12technology/fluxtion/blob/master/extensions/fu-text/api/src/main/java/com/fluxtion/ext/futext/api/event/EofEvent.java) events for processing within a SEP.

Fu-text exposes text processing as higher order functions to define logical text processing. A declarative higher-order approach is used to simplify defining text processing within a SEP. A function creates a node and adds it to the graph for use by other nodes either declaratively or imperatively.

The example below demonstrates the power of higher order functions combined with Fluxtion. We generate a SEP that processes CSV input, maps all non-transient fields from a provided bean class and marshalls to a bean instance for well formed rows. The parser is zero gc and handles millions of records per second. An event sink is added as node to this SEP, forwarding valid bean instances as events to a child SEP.

```java
EventHandler sep  = sepInstance((c) -> 
                                csvMarshaller(WorldCityBeanTransient.class).build()
                                , pckg, className);
```

## Requirements

| fu-text lib                                                                                                                                                | scope     | dependency                         |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------- | --------- | ---------------------------------- |
| [fluxtion-fu-text-api](https://github.com/v12technology/fluxtion/tree/master/extensions/fu-text/api)                                                       | runtime   | fluxtion-declarative-api           |
|                                                                                                                                                            |           | fluxtion-api                       |
| [fluxtion-fu-text-builder](https://github.com/v12technology/fluxtion/tree/master/extensions/fu-text/builder/src/main/java/com/fluxtion/ext/futext/builder) | buildtime | fluxtion-declarative-builder       |
|                                                                                                                                                            |           | fluxtion-api                       |
|                                                                                                                                                            |           | fluxtion-declarative-api           |
|                                                                                                                                                            |           | fluxtion-builder                   |
|                                                                                                                                                            | Inprocess | fluxtion-declarative-builder       |
|                                                                                                                                                            |           | fluxtion-api                       |
|                                                                                                                                                            |           | fluxtion-declarative-api           |
|                                                                                                                                                            |           | fluxtion-builder                   |
|                                                                                                                                                            |           | fluxtion-generator - non classpath |

The Fluxtion generator is not required on the classpath at build time, but the tool used at build time must have access to the Fluxtion generator. An example would be the [maven plugin](https://fluxtion.gitbook.io/docs/extensions/tools/maven-plugin) that encapsulates the Fluxtion generator.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://fluxtion.gitbook.io/docs/extensions/fu-text.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
