<commit_before># Gramsearch
Search keyword within string chars and files. More complete than _str.find(keyword)_ function.

## Installation
```
$ pip install grsearch
```
### Compatibility
- Python3.4
- Linux/Windows

## Usage

```
import grsearch

text="""
  Python interpreters are available for installation on many operating systems,
  allowing python code execution on a wide variety of systems.
  """
keywords=['python','systems']

#return list [[keyword, number_of_occurences, [positions]]
result=search(test, keywords)

print(result)
```

```
[['python', 2, [0, 87]], ['systems', 2, [69, 130]]]
```
### Examples with more parameters :
```
result=search(test, keywords, case_sensitive=True)
print(result)
```

```
[['python', 1, [87]], ['systems', 2, [69, 130]]]
```

```
result=search(test, keywords, limit_iteration=1)
print(result)
```

```
[['python', 1, [87]], ['systems', 2, [69, 130]]]
```<commit_msg>add more info in README<commit_after># Gramsearch
Search keyword within string chars and files. More complete than _str.find(keyword)_ function.

## Installation
```
$ pip install grsearch
```
### Compatibility
- Python3.4
- Linux/Windows

## Usage

### With string characters
```
import grsearch

text="""
  Python interpreters are available for installation on many operating systems,
  allowing python code execution on a wide variety of systems.
  """
keywords=['python','systems']

#return list [[keyword, number_of_occurences, [positions]]
result=grsearch.search(test, keywords)

print(result)
```

```
result: [['python', 2, [0, 87]], ['systems', 2, [69, 130]]]
```
### Examples with more parameters :
```
result=grsearch.search(test, keywords, case_sensitive=True)
print(result)
```

```
result: [['python', 1, [87]], ['systems', 2, [69, 130]]]
```

```
result=grsearch.search(test, keywords, limit_iteration=1)
print(result)
```

```
result: [['python', 1, [0]], ['systems', 1, [69]]]
```

### With files
```
import grsearch

path_file="Documents/text.txt"
keywords=['python','systems']

#return list [[keyword, number_of_occurences, [positions]]
result=grsearch.search_infile(path_file, keywords)

print(result)
```

```
result: [['python', 2, [0, 87]], ['systems', 2, [69, 130]]]
```
All parameters (case_sensitive, limit_iteration, exactly) is available with search within file.

### Parameter __exactly__

```
import grsearch

text="I'm herrersystem and my operating system is not windows."
keywords=['system']

#return list [[keyword, number_of_occurences, [positions]]
result=grsearch.search(text, keywords, exactly=True)

print(result)
```

```
result: [['system', 1, [34]]]
```

_Result with exactly = False_

```
result: [['system', 2, [10, 34]]]
```
{'fraction_non_alphanumeric': 0.18635855385762207, 'fraction_numerical': 0.028326500186358555, 'mean_word_length': 5.989583333333333, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2026138', 'n_tokens_mistral': 981, 'n_tokens_neox': 860, 'n_words': 255}