Could YOU Please help me out of this question This is how I started typing but at the end I got stuck My half of the answers I attached. please Help I will give you brainiest


we will work on text processing and analysis. Text analyzers could be used to identify the language in which a text has been written (language detection), to identify keywords in the text (keyword extraction) or to summarize and categorize a text. You will calculate the letter (character) frequency in a text. Letter frequency measurements can be used to identify languages as well as in cryptanalysis. You will also explore the concept of n-grams in Natural Language Processing. N-grams are sequential patterns of n-words that appear in a document. In this project, we are just considering uni-grams and bi-grams. Uni-grams are the unique words that appear in a text whereas bi-grams are patterns of two-word sequences that appear together in a document.


Write a Java application that implements a basic Text Analyzer. The Java application will analyze text stored in a text file. The user should be able to select a file to analyze and the application should produce the following text metrics:


1. Number of characters in the text.

2. Relative frequency of letters in the text in descending order. (How the relative frequency that you calculated compares with relative letter frequencies in English already published?)

3. Number of words in the text.

4. The sizes of the longest and the shortest word.

5. The twenty most repeated uni-grams (single words) in the text in descending order.

6. The twenty most repeated bi-grams (pairs of words) in the text in descending order.


Test your program in the file TheGoldBug1.txt, which is provided.

Answers

Answer 1

The given program based on the question requirements is given below:

The Program

public static void analyzeChar(String text)

{

text = text.toLowerCase();

char [] characters = new char[26];

int [] rep =new int[26];

//populate the array of characters

char ch = 'a';

for (int i =0; i < characters.length; i++)

{

characters[i] = ch;

ch++;

}

itz72

//System.out.println(Arrays.toString(characters));

//System.out.println(Arrays.toString(rep));

//how many times each characters repeats

for (int i =0 ; i < text.length (); i++ )

{

ch = text.charAt(i);

if(ch>= 'a'&& ch<= 'z')

{

rep[(int)(ch-'a')]++;

}

itz72

}

//show the number of repetitions

for (int i = 0; i < rep.length; i++)

{

System.out.println("character" + characters[i] + "reapeats"+ rep[i]);

}

}

itz72

public static void calcNumChar(String text)

{

System.out.println("The number of characters is: " + text.length());

}

public static String getText(String fileName) throws IOException

{

String line = "", allText = "";

//open the file

File file = new File(fileName);

Scanner inputFile = new Scanner(file);

//read the file

while(inputFile.hasNext())

{

line = inputFile.nextLine();

//System.out.println(line);

allText=allText + (" " + line);

}

itz72

//close the file

inputFile.close();

return allText;

}

public static String getFilename()

{

String file;

Scanner kb = new Scanner(System.in);

System.out.print("Enter the name of the file: ");

file = kb.nextLine();

return file;

}

}

This script contains numerous functions that aid in the examination and manipulation of written materials. This program determines the incidence of every letter present in the supplied text, tallies the overall character count, and includes the ability to import text from a file.

Read more about programs here:

https://brainly.com/question/26497128

#SPJ1


Related Questions

In Excel, is there a way to have two variables added together like this?

x = x + y where, for example, x=2 y=3
x = 2 + 3
then making cell x = 5 rather than the original 2

Answers

Yes, in Excel, one can perform the above Operation. Note that the instruction must be followed to get the result. See the attached image for the output.

How can this be done?

In separate cells, enter the x and y values. Enter 2 in cell A1 and 3 in cell A2, for example.

Enter the formula "=A1+A2" in another cell. Enter "=A1+A2" in cell A3, for example.

When you press enter or return, the calculation result (5) will appear in cell A3.

If you replace the value of x with the computation formula, it will result in a circular reference error.

A circular reference in Excel indicates that the calculation in a certain cell refers to it's own result once or several times.

Note that x cannot be equal to x + y except y is 0.

Learn more about Excel:
https://brainly.com/question/31409683
#SPJ1

To be done in C#
• Description of the class
• Class properties for each attribute listed with the class with public get and set accessors
• Implement other methods as described in the class descriptions/UML diagram

The main application must do the following
• Print a line that states "Your Name - Week 1 Composition Performance Assessment"
Create 2 instances of the Automobile class using parameters of your choosing
Add at least 2 tires to the instances
Add some tires by passing a Tire object to the AddTire method
Add some tires by passing the parameters to create a Tire object to the AddTire method

Print one of the instance's properties to the console using the ToString method

Print one of the instance's properties to the console using the GetInfo method

Print the following for one of the instances using property accessors (all information must be included; formatting and order is up to you):
Make, Model, Color, Body Style, Engine Information, Number of Cylinders, Approved Gas Type, Fuel Injected?

Tire Information for each tire
Manufacturer, Tire Size, Max Pressure, Min Pressure, and Type

Class Descriptions & Additional Requirements
Class Automobile will be the class that is composed of other classes and will have the properties and methods described below
Properties:
Make - type string, the automobile manufacturer (e.g., Ford, Jaguar)
Model-type string, the model description (e.g., Explorer, Navigator)
Color - type string, the car's color
BodyStyle - type string, car style description (e.g., Sedan, SUV)
EngineInfo - type Engine, engine information object (see Engine Class for details)
Tires - collection of type Tire, list/array of the tire objects included in the automobile

Methods:
GetInfo() - gets formatted (you determine the format) class information including: Make, Model, Color, Engine Cylinder Count, Fuel Injected or Not, and Number of Tires
ToString() - gets all class information, you determine the format
AddTire(Tire) - adds a tire object to the Tires property
AddTire(string, string, int, int, string) - adds a tire object to the Tires collection via parameters

Class Engine
Properties
Cylinders - type integer, the number of cylinders the engine has
GasType - type string, approved type of fuel, e.g., Diesel, Unleaded 87 octane, Ethanol Free
Fuellnjected - type bool, whether the engine is fuel injected or carburetor-based

Methods
No additional required methods; you may create additional methods at your discretion

Class Tire
Properties
Manufacturer - type string, the tire manufacturer, e.g., Continental, Pirelli
Size - type string, the tire size, e.g., 185/60R13, 165/50R15
MaxPressure-type integer, the maximum pressure for the tire
MinPressure - type integer, the minimum pressure for the tire
Type - type string, the type of tire, e.g. All Season Radial, Studded Snow, Spare

Methods
No additional required methods; you may create additional methods at your discretion

Automobile 1 is to use ToString()
Automobile 2 is to use GetInfo()

Answers

Practice with examples is the most effective way to learn C++. Examples on fundamental C++ ideas can be found on this page. It is encouraged that you use the examples as references and test the concepts on your own and Programme.

Thus, All of the programs on this page have been tested, so they should all run well.

Examining a ton of sample programs is one of the finest ways to learn how to program in a new language. It is recommended to copy and paste each of the programs listed below into a text file before compiling them.

Try the experiments after that. You will become more familiar with various C++ features by expanding these example programs, and you'll feel more at ease when it comes time to build programs from scratch.

Thus, Practice with examples is the most effective way to learn C++. Examples on fundamental C++ ideas can be found on this page. It is encouraged that you use the examples as references and test the concepts on your own and Programme.

Learn more about Programe, refer to the link:

https://brainly.com/question/14368396

#SPJ1

whats the best practices for a cyber security agent ??

Answers

Some of the key best practices for a cyber security agent include:

Stay updatedImplement strong security measuresPractice secure coding and development

What should cyber security agents watch out for ?

Sustained awareness of the ever-evolving cybersecurity landscape is imperative. Agents must actively pursue knowledge through training, certifications, and participation in industry events to stay abreast of the latest threats, trends, and technologies.

Implementing formidable security measures is paramount. This encompasses deploying firewalls, intrusion detection systems, encryption protocols, and fortified authentication mechanisms.  Emphasize secure coding practices during the development lifecycle.

Find out more on cyber security at https://brainly.com/question/31026602

#SPJ1

Choose the correct term to complete the sentence.
The media is usually repressed in
governments.

Answers

A dictator government  has all power in the hands of one individual/group, suppressing opposition.  The media is usually repressed in dictatorial government

What is the government?

Dictatorships have limited to no respect for civil liberties, including press freedom. Media is tightly controlled and censored by the ruling authority. Governments may censor or control the media to maintain power and promote propaganda.

This includes restricting freedom of speech and mistreating journalists. Dictators control information flow to maintain power and prevent challenges, limiting transparency and public awareness.

Learn more about government from

https://brainly.com/question/1078669

#SPJ1

10. As a simple pendulum swings back and forth, the forces acting on the suspended object are the gravitational force, the tension in the supporting cord, and air resistance. (a) Which of these forces, if any, does no work on the pendulum? (b) Which of these forces does negative work at all times during its motion? (c) Describe the work done by the gravitational force while the pendulum is swinging.​

Answers

Solution

(i) Answer (b). Tension is perpendicular to the motion. (ii) Answer (c). Air resistance is opposite to the motion.

Answer:

Hey there! It looks like you’re asking about the forces acting on a simple pendulum. Here’s what I know:

(a) The tension in the supporting cord does no work on the pendulum because the force is always perpendicular to the direction of motion.

(b) Air resistance does negative work at all times during the pendulum’s motion because it always opposes the motion.

© The work done by the gravitational force while the pendulum is swinging depends on the position of the pendulum. When the pendulum is at its highest point, the gravitational force does no work because it is perpendicular to the direction of motion. As the pendulum swings downward, the gravitational force does positive work because it is in the same direction as the motion. When the pendulum reaches its lowest point and starts to swing upward, the gravitational force does negative work because it opposes the motion.

Carefully
1.) What do you call a computer-controlled test and measurement equipment that allows for testing with minimal human interaction? B.) DUT C.) SCRS A.) ATE D.) SOPS
2.) What is the other term used in referring a digital multimeter? A.) analyzer B.) generator C.) fluke D.) scope
3.) Which of the following is not part of the process flow under DUT? A.) communication C.) data analyzer B.) cost efficiency D.) test software
4.) Which of the following is not classified as a passive electronic component? D.) transistor A.) capacitor B.) inductor C.) resistor
5.) Which of the following statement best support debugging as a testing method for electronic components? A.) It is essential in maintaining an error free project. B.) It allows electronics engineer to showcase their skills. C.) It is useful in analyzing the functions of every electronic components. D.) It helps to identify the failures or flaws which can prevent the circuit from damaging.
6.) What does the prefix "meta" under the word Metadata means? A.) set of codes B.) group of data C.) classifications of data or concept D.) underlying concept or explanation
7.) What do you call a type of metadata wherein we have to be able to connect this back to the source data sets when we provide information to the end- user? A.) Extraction C.) Operational B.) End-user D.) Transformation
8.) Which of the following is not a specialized tool? A.) Frequency Counter C.) Logic Analyzer B.) Function Generator D.) Spectrum Analyzer
9.) What do you call a combination of hardware and software design with custom printed circuit boards (PCB) that are assembled into a fully functional prototype? A.) debugging B.) inspection C.) prototyping D.) testing
10.) What do you call a specialized tool which is used in detecting the interference in the cables and electronic components? A.) Frequency Counter C.) Spectrum Analyzer B.) Function Generator
11.) Which of the following is generator? A.) circular B.) sawtooth D.) Vector Network Analyzer Equipment not a generated waveform when using a function C.) sine D.) square 10​

Answers

1.) A) ATE (Automated Test Equipment), 2.) C) fluke

3.) B) cost efficiency, 4.) D) transistor, 5.) D) It helps to identify the failures or flaws which can prevent the circuit from damaging, 6.) C) classifications of data or concept, 7.) A) Extraction

8.) D) Spectrum Analyzer, 9.) C) prototyping, 10.) C) Spectrum Analyzer, and 11.) B) sawtooth

What is an automated test equipment?

Automated Test Equipment (ATE) is a computer-controlled testing system or equipment used to perform various tests and measurements on electronic devices, components, or systems.

It is commonly used in manufacturing, quality control, and research and development environments to ensure the proper functioning and reliability of electronic products.

learn more about Automated Test Equipment: https://brainly.com/question/30288648

#SPJ1

Which of the following would be considered unethical for a programmer to do? (5 points)

Create software used to protect users from identity theft
Ignore errors in programming code that could cause security issues
Protect users from unauthorized access to their personal information
Use someone else's code with the original developer's permission

Answers

One thing that would be onsidered unethical for a programmer to do is B. Ignore errors in programming code that could cause security issues

Why would this be unethical for a programmer ?

Creating software designed to protect users from identity theft stands as a commendable and ethical endeavor, demonstrating the programmer's commitment to safeguarding user information and thwarting identity theft.

Engaging in such behavior would be considered unethical since it undermines the security and integrity of the software, potentially exposing users to vulnerabilities and compromising their sensitive data. Respecting intellectual property rights and obtaining proper authorization reflects adherence to ethical and legal standards.

Find out more on programmers at https://brainly.com/question/13341308

#SPJ1

Other Questions
a+wooden+tool+is+found+to+have+12.5%+of+the+original+c614+present.+if+the+half-life+of+c614+is+5730years,+how+many+years+old+is+the+wooden+tool? Question Find the distance between the two points. (12, 5), (12, 2) optimally, drug abuse treatment should combine a pharmacological approach with Companies make choices in their HR processes that can help maintain the culture. The processes include a. recruiting, training, and promoting. b. recruiting, hiring, and training. c. recruiting, hiring, and promoting. Consider two cylindrical objects of the same mass and radius. Object A is a solid cylinder, whereas object B is a hollow cylinder.How fast, in meters per second, is object A moving at the end of the ramp if it's mass is 130 g, it's radius 34 cm, and the height of the beginning of the ramp is 17.5 cm? How fast, in meters per second, is object B moving at the end of the ramp if it rolls down the same ramp? T/F the two types of short-term effects on currency movements are transactions risk and transformational risk. 3. SEP Use Models Evaluate Gita's modeland explain whether her sister can use it tocorrectly describe the patterns of theseasons on Earth. (a) Consider three sequences (an), (bn) and (sn) such that an sn bn for all n and lim an = lim b = s.Prove lim sn = s. This is called the "squeeze lemma." (b) Suppose (sn) and (tn) are sequences such that |sn| tn for all n and lim tn = 0. Prove lim sn = 0. a pension plan that requires employers to guarantee a minimum return is referred to as a(n) erify that the vector X is a solution of the given system. X'= 10 1 1 ox; X = -2 0-1 sin(t) 1 sin(t) cos(t) 2 -sin(t) + cos(t) For X = sin(t) 1 sin(t) cos(t) 2 -sin(t) + cos(t) one has X' 1 0 1 1 1 0 X- 1-2 0-1 Since the above expressions -Select- sin(t) sin(t) cos(t) is a solution of the given system. -sin(t) + cos(t) if at a particular instant and at a certain point in space the electric field is in the x-direction and has a magnitude of 4.80 v/m , what is the magnitude of the magnetic field of the wave at this same point in space and instant in time? what weapons skill and knowledge does pecos bill use to defeat the cyclone Terrell is NOT feeling hungry at the moment. This is likely because his:a.ghrelin levels are low.b.PYY levels are low.c.blood glucose level has dropped.d.level of orexin is high. 2. PART B: Which detail from the text best supports theanswer to Part A?OA. "Members of the next generation of Mirabals arenow Vice President and Deputy Foreign Minister. Atthe same time, a marked change in the politicalclimate has completed the transformation of 'theButterflies" (Paragraph 3)OB. "The story was always alive, but the country wasunable to come to terms with it so long as he wasaround' Ms. Alvarez said." (Paragraph 7)O C. "Throughout Latin America, the Mirabals areregarded as feminist icons, a reminder that we haveour revolutionary heroines, our Che Guevaras, too"(Paragraph 13)O D. "Our Government has to be the negation of thepast, and cannot give in to the rancors of the past. Itis not that there are idividuals who are guilty, but asystem that was guilty." Paragraph (21) c has multiple forms of inheritance true false if your potential evapotranspiration exceeds your precipitation, then you are automatically this type of climate? at which stage in the product life cycle are discounts and coupons offered evaporation of one liter of sweat would result in the loss of ________ kcal of heat. In the context of the entire passage, the word "anecdote" (line 1) is best understood to mean(A) an unreliable secondhand account(B) an official government document(C) a narrative in the style of a morality play(D) an informal story involving personal details according to zimbardo, there is a constellation of factors explaining shyness. each of the following would apply except: