Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

https://github.com/tanloong/interlaced.nvim

Neovim plugin for aligning bilingual parallel texts
https://github.com/tanloong/interlaced.nvim

corpus-linguistics nvim-plugin parallel-corpus sentence-alignment

Last synced: 2 days ago
JSON representation

Neovim plugin for aligning bilingual parallel texts

Lists

README

        

# interlaced.nvim

Join/split current line to align bilingual sentence pairs.

## Features

1. Join current line up to previous pair


GIF

2. Split current line down to the next pair


GIF

## Requirements

+ Neovim >= **0.9.0**

## Installation

+ Using [lazy.nvim](https://github.com/folke/lazy.nvim)

```lua
{
'tanloong/interlaced.nvim',
config = function()
require("interlaced").setup()
-- or setup with your own config (see Configuration in README)
-- require("interlaced").setup(config)
end,
ft = "text",
},
```
## Configuration

Bellow is a linked snippet with the default values.

https://github.com/tanloong/interlaced.nvim/blob/a74a72dcfc3a4a5208ace8cfbcf8c182e779c4fa/lua/interlaced/config.lua#L1-L18

## Commands

- `SplitEnglishSentences` and `SplitChineseSentences`: These commands are used for sentence segmentation in a **monolingual** buffer. It is important to note that they may not handle all cases perfectly, as they use simple regex patterns to identify sentence boundaries. For more accurate splitting, it is recommended to use an NLP tool. However, if you just want a quick and not-that-accurate splitting, these commands can be helpful.

- `MapInterlaced` and `UnmapInterlaced`: `MapInterlaced` sets keybindings for text manipulations; `UnmapInterlaced` restores them to their previous mappings, if any.

- `InterlaceWithL1` and `InterlaceWithL2`: Take lines from the current buffer and interlaces them with lines from a specified file, forming an array of `(l1, l2)` pairs. These commands also filter out any empty lines from both the buffer and the file to ensure that only non-empty lines are interlaced. The resulting interlaced text is then saved to a new file and opened for further editing. After openning the interlaced file, keybindings are setup if they have not been previously.