1. In as few lines as possible, in JAVASCRIPT with Node.js, code a term frequency program that is similar to how it is done efficiently by this Python version below: #!/usr/bin/env python import heapq, re, sys words = re.findall("[a-z]{2,}", open(sys.argv[1]).read().lower()) for w in heapq.nlargest (25, set(words) - set(open(../stop_words.txt").read().split(",")), words.count): print(w, '-', words.count(w)) IT MUST: take the input files on command line (e.g., node [this javascript file name here] pride-and-prejudice.txt) and output to a text file after filtering the stop words. The input file txt is called pride-and-prejudice.txt and the stop words input file is called stop_words.txt. The output must be made to a file NOT command line output, called output.txt and include ONLY the top 25 results and frequency count (after removing stop words obviously). The stop words looks like this: a,able, about, across, after all, almost, also, am, among, an,and,any,are, as, at, be, because, been, but, by, can, cannot,cou 1d, dear,did, do, do Ensure to stick to these file names in the code solution. 2. In part 2, Using Python, implement a recursive solution to the term frequency problem where parsing words from the stream of characters is recursive. Much like the JSON parse function, the parse function should take a character-level file reader, a list of words (initially empty), and the list of stop words, and should return a list of the non-stop words. The function should iterate to get the characters of one single word, and then recurse to get the rest of the words. You can do the rest of the program (counting words, printing them) in non-recursive style. Make sure to include the command line instructions for this second Python version as well. Also make sure the Output.txt includes the filtered words AND the frequency count.
Step by step
Solved in 3 steps with 2 images
for the python solutionI'm getting the following error: "RecursionError: maximum recursion depth exceeded while calling a Python object" Please revise the code to avoid this issue when running it. If it makes a difference the counting of words and printing them do not require recursive style for this solution, just the parsing words from the stream of characters needs to be recursive.
the first solution makes sense but for the python one, I'm getting the following error. please help. RecursionError: maximum recursion depth exceeded while calling a Python object (base)
Please help me and provide a workout around to this error.
You can do the rest of the program (counting words, printing them) in non-recursive style. if that helps