https://github.com/r0mb0/words_search_tree_in_classic_asp
Implementation of a Search Tree in Classic ASP
https://github.com/r0mb0/words_search_tree_in_classic_asp
Last synced: 3 months ago
JSON representation
Implementation of a Search Tree in Classic ASP
- Host: GitHub
- URL: https://github.com/r0mb0/words_search_tree_in_classic_asp
- Owner: R0mb0
- License: mit
- Created: 2025-02-11T10:22:38.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-27T11:27:52.000Z (over 1 year ago)
- Last Synced: 2025-02-27T13:00:20.958Z (over 1 year ago)
- Language: Classic ASP
- Homepage:
- Size: 91.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Security: SECURITY.md
- Support: SUPPORT.md
Awesome Lists containing this project
README
# Words search tree in Classic ASP
[](https://app.codacy.com/gh/R0mb0/Words_search_tree_in_classic_asp/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
[](https://github.com/R0mb0/Words_search_tree_in_classic_asp)
[](https://github.com/R0mb0/Words_search_tree_in_classic_asp)
[](https://opensource.org/license/mit)
[](http://paypal.me/R0mb0)
## Tree structure
- **Words**
- nana
- baba
- banana
### Chart

> #### ⚠️ Commenting `Private Function write_array(...)`
>
> **In case of writing all tree's elements, the tree is explored in iterative way that produce a linear output**
## `words_search_tree.class.asp`'s avaible functions
- Initialize the class -> `Public Function initialize(ByVal termin, ByVal case_sens, ByVal remove_special_char, ByVal remove_lett, ByVal remove_numb, ByVal remove_all_numb)`
>
> **Where the params are:**
> - `termin` -> The terminator character (must be a special character as "-").
> - `case_sens` -> case sensitive option, could be "true" or "false", if "false", all text will be transformed in lower case.
> - `remove_special_char` -> remove special characters, could be "true" or "false", if true, the special chacters will be removed from the text.
> - `remove_lett` -> remove single letters, could be "true" or "false", if "true", the sigle letters will be removed, for example " a ".
> - `remove_numb` -> remove number, could be "true" or "false", if "true" the numbers will be removed, for example " 123 "
> - `remove_all_numb` -> remove all numbers from text, cuold be "true" or "false", if true, all numbers will be removed, for example: "Hi123" became "Hi"
>
> **⚠️ "remove_numb" and "remove_all_numb" params could not be true simultaneously!**
- Add a word to the tree -> `Public Function add_word(ByVal word)`
- Add all text words in the tree -> `Public Function add_text(ByVal text)`
- Print all elements inside the tree -> `Public Function Write_all_elements()`
- Check if a word is in the tree -> `Public Function is_present(ByVal word)`
- Search a word inside the memory -> `Public Function search_word(ByVal word, ByVal is_array)`
>
> **This function is usefull to search a word inside the tree, for example if `word` = "hom" the function will return: "home", "homo" and "hometown"**
> - `word` is the word to search, it could be a part of a word, if an entire word is passed to the function, the function will return null.
> - `is_array` change the output of the function, if `true` the function will return an array with all results, else, will be returned a string
- Function to save to file the tree state -> `Public Function save_tree(ByVal path)`
> **Where `path` is the string with the location with the file to save location**
- Function to load the saved state tree in a file -> `Public Function load_tree(ByVal path)`
> **Where `path` is the string with the location with the file to load location**
## How to use
> From: `Test.asp`
1. Initialize the class
```asp
<%@LANGUAGE="VBSCRIPT"%>
<%
Dim tree
Set tree = new words_search_tree
tree.initialize "-", true, true, true, false, true
```
2. Add values to tree
Possibilities:
- > Load tree from file
```asp
tree.load_tree("path")
```
- Add words
```asp
tree.add_word("nana")
tree.add_word("baba")
tree.add_word("banana")
```
- Add text
```asp
tree.add_text("Nel mezzo del cammin di nostra vita mi ritrovai per una selva oscura, che la diritta via era smarrita.")
tree.add_text("Ahi quanto a dir qual era è cosa dura esta selva selvaggia e aspra e forte che nel pensier rinova la paura!")
```
3. > Save the state of tree
```asp
tree.save_tree("path")
```
4. Interrogate the tree
Possibilities:
- Check if a word is in the tree
```asp
tree.is_present("banana")
```
- Search a word inside the tree
```asp
tree.search_word("bana", false)
%>
```