python – TypeError: ‘

Sorry this is my first project face the error TypeError: ‘<‘ not supported between instances of ‘TextWord’ and ‘TextWord’
The purposes of this code to implement a search engine using Binary-tree and balanced binary search tree
search a text file and text words from the file when ever put any words codes run successful, however when put some file name like from the project samllText.txt or dictionary.txt that has some random text data.
The main() function and this part of code for line 9,14,20

from BTreeWordFinder import *
from BalancedBTree import *

class BalancedBTreeWordFinder(BTreeWordFinder):
    '' 'binary search class implemented with a balanced binary tree; inherits from BTreeWordFinder and thus takes advantage of its methods' ''

    def __init__(self, file, btree=None):
        '' 'Builder methods' ''
        BTreeWordFinder.__init__(self, file, btree)

    @staticmethod
    def main():
        '' 'main method version of the class for the search engine implemented with a balanced tree' ''
        b = BalancedBTreeWordFinder(BalancedBTreeWordFinder.askFile(), BalancedBTree())
        b.findOcurrencesInFile('dictionary.txt')
        b.viewIndex()
        b.showDepth()

if __name__ == "__main__":
 BalancedBTreeWordFinder.main()


**This part of code for BTreeWordFinder.py for line 15 error**   


 def __init__(self, file, tree=None):
        '' 'Builder methods' ''
        self.bTree = None
        if not tree:
            self._bTree = BTree()
        else:
            self._bTree = tree
        self.appendText(file)

This part of code from BTreeWordFinder.py line for 61 error

 def appendText(self, file):
        '' 'Read the file and break it down into lines and words per line' ''
        try:
            with open(file, 'r') as reader:
                numLine = 1
                t1 = time.perf_counter()
                for line in reader.readlines():
                    numWord = 1
                    if line:
                        for word in line.split():
                            item = word.lower()
                        self.getBTree().insertWord(TextWord(item, numLine, numWord))
                        numWord += 1
                    numLine += 1
                t2 = time.perf_counter()
                print(u"n Text words have been inserted into the tree. The insertion time was {} ms.".format(
                    (t2 - t1) * 1000))
        except  IOError:
            print("The given file name does not exist.")

This code from BalancedBTree.py for line 17 error

def insertWord(self, item, probe=None):
        '' 'insert a word, with the addition that after doing so it checks if it is necessary to modify the structure of the tree while balancing it' ''
        if not probe:
            probe = self.getRoot()
        if probe:
            if item < probe.getVal():
                if probe.getLeft() != None:
                    self.insertWord(item, probe.getLeft())
                else:
                    probe.setLeft(Node(item, None, None, probe))
                    self.updateBalance(probe)  # we inserted; we check if it is necessary to balance
            elif item > probe.getVal():
                if probe.getRight() != None:
                    self.insertWord(item, probe.getRight())
                else:
                    probe.setRight(Node(item, None, None, probe))
                    self.updateBalance(probe)  # we inserted; we check if it is necessary to balance
            else:  # equals
                probe.getVal().getCoords().append(item.getCoords())
        else:
            self.setRootVal(item)

Complete errors running time
D:Python3.8.0Pythonpython.exe D:/btree-word-finder-master/btree-word-finder-master/Code_and_texts/BalancedBTreeWordFinder.py
<class ‘BTree.BTree’>
Balanced Binary Search tree
Enter file name (Ex: smallText.txt) —->smallText.txt
Traceback (most recent call last):
File “D:/btree-word-finder-master/btree-word-finder-master/Code_and_texts/BalancedBTreeWordFinder.py”, line 20, in
BalancedBTreeWordFinder.main()
File “D:/btree-word-finder-master/btree-word-finder-master/Code_and_texts/BalancedBTreeWordFinder.py”, line 14, in main
b = BalancedBTreeWordFinder(BalancedBTreeWordFinder.askFile(), BalancedBTree())
File “D:/btree-word-finder-master/btree-word-finder-master/Code_and_texts/BalancedBTreeWordFinder.py”, line 9, in init
BTreeWordFinder.init(self, file, btree)
File “D:btree-word-finder-masterbtree-word-finder-masterCode_and_textsBTreeWordFinder.py”, line 15, in init
self.appendText(file)
File “D:btree-word-finder-masterbtree-word-finder-masterCode_and_textsBTreeWordFinder.py”, line 61, in appendText
self.getBTree().insertWord(TextWord(item, numLine, numWord))
File “D:btree-word-finder-masterbtree-word-finder-masterCode_and_textsBalancedBTree.py”, line 17, in insertWord
if item < probe.getVal():
TypeError: ‘<‘ not supported between instances of ‘TextWord’ and ‘TextWord’

Process finished with exit code 1