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)

    def main():
        '' 'main method version of the class for the search engine implemented with a balanced tree' ''
        b = BalancedBTreeWordFinder(BalancedBTreeWordFinder.askFile(), BalancedBTree())

if __name__ == "__main__":

**This part of code for for line 15 error**   

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

This part of code from line for 61 error

 def appendText(self, file):
        '' 'Read the file and break it down into lines and words per line' ''
            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 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())
                    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())
                    probe.setRight(Node(item, None, None, probe))
                    self.updateBalance(probe)  # we inserted; we check if it is necessary to balance
            else:  # equals

Complete errors running time
D:Python3.8.0Pythonpython.exe D:/btree-word-finder-master/btree-word-finder-master/Code_and_texts/
<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/”, line 20, in
File “D:/btree-word-finder-master/btree-word-finder-master/Code_and_texts/”, line 14, in main
b = BalancedBTreeWordFinder(BalancedBTreeWordFinder.askFile(), BalancedBTree())
File “D:/btree-word-finder-master/btree-word-finder-master/Code_and_texts/”, line 9, in init
BTreeWordFinder.init(self, file, btree)
File “”, line 15, in init
File “”, line 61, in appendText
self.getBTree().insertWord(TextWord(item, numLine, numWord))
File “”, line 17, in insertWord
if item < probe.getVal():
TypeError: ‘<‘ not supported between instances of ‘TextWord’ and ‘TextWord’

Process finished with exit code 1