In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "how to use java and python to make a professional terminology learning machine". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to use java and python to make a professional terminology learning machine".
First of all, we need some professional terms to be made into dictionaries, and some of them are selected and combined to generate professional terms.
I decided to choose four technical terms from the dictionary, so I made four dictionaries. Although the capacity is not big enough, it is enough to play as a toy.
Here is my dictionary of professional nouns:
String [] word1 = {"available", "disabled", "127", "balance", "transfer", "4Accord 3", "2can7", "78%", "Universal", "qualified"}; String [] word2 = {"RNA", "DNA", "Serial device", "Cell", "High capacity", "protozoa", "Separation"} String [] word3 = {"bus", "virus", "compile", "computer", "computer virus", "Mobile", "Mass production tool", "petri dish", "form"}; String [] word4 = {"Control Panel", "Actuator", "Log", "Controller", "Panel", "user", "Storage", "Administrator", "Domain", "ruler", "counter"}
You can add your own professional terms to the dictionary.
Next, we need random numbers to select words from the dictionary. The random method is used here:
Int N1 = (int) (Math.random () * 10); / / anyone with some experience should understand, int N2 = (int) (Math.random () * 7); int n3 = (int) (Math.random () * 9); int N4 = (int) (Math.random () * 11)
Next, put the nouns together to output:
System.out.print ("\ nThe technical term you generated is:\ n" + word1 [N1] + word2 [N2] + word3 [N2] + word4 [N4] + "\ n")
At this point, I want to batch generate technical terms how to do?
How many technical terms are required to get user input:
System.out.print ("Please enter the number of technical terms to generate:"); Scanner sc = new Scanner (System.in)
Convert to int:
Int numbersc = sc.nextInt ()
Use the counter to see if you have finished outputting the required technical terms:
Int number = 0while (number < numbersc) {int N1 = (int) (Math.random () * 10); int N2 = (int) (Math.random () * 7); int n3 = (int) (Math.random () * 9); int n4 = (int) (Math.random () * 11) The technical term System.out.print ("\ nth" (number + 1) + "you generated" is:\ n "+ word1 [N1] + word2 [N2] + word3 [N2] + word4 [N4] +"\ n "); number = number + 1;}
To run in a continuous cycle:
While (true) {System.out.print ("Please enter the number of technical terms to be generated:"); Scanner sc = new Scanner (System.in); int numbersc = sc.nextInt (); int number = 0 while (number < numbersc) {int N1 = (int) (Math.random () * 10); int N2 = (int) (Math.random () * 7) Int n3 = (int) (Math.random () * 9); int N4 = (int) (Math.random () * 11); System.out.print ("\ n" + (number + 1) + "the technical term" is:\ n "+ word1 [N1] + word2 [N2] + word3 [N2] + word4 [N4] +"\ n "); number = number + 1 } System.out.print ("\ n\ n");}
Finally, the complete code is given:
Pt.java:
Import java.util.Scanner;public class pt {public static void main (String [] args) {String [] word1 = {"available", "disable", "127%", "balance", "transfer", "4max 3", "2max 7", "78%", "Universal", "qualify"} String [] word2 = {"RNA", "DNA", "serial device", "cell", "large capacity", "protozoa", "separation"}; String [] word3 = {"bus", "virus", "compiler", "computer", "computer virus", "mobile", "mass production tool", "petri dish", "morphology"} String [] word4 = {"Control Panel", "Actor", "Log", "Controller", "Panel", "user", "Storage", "Administrator", "Domain", "ruler", "counter"}; while (true) {int number = 0; System.out.print ("Please enter the number of technical terms to be generated:") Scanner sc = new Scanner (System.in); int numbersc = sc.nextInt (); while (number < numbersc) {int N1 = (int) (Math.random () * 10); int N2 = (int) (Math.random () * 7); int n3 = (int) (Math.random () * 9) Int n4 = (int) (Math.random () * 11); System.out.print ("\ nth" + (number + 1) + "the technical term" is:\ n "+ word1 [N1] + word2 [N2] + word3 [N2] + word4 [N4] +"\ n "); number = number + 1 } System.out.print ("\ n\ n");}
And the promised python3 code in the title:
Pt.py3
Import random;word1 = ["available", "disabled", "127", "balance", "transfer", "4max 3", "2max 7", "78%", "generic", "qualified"]; word2 = ["RNA", "DNA", "serial device", "cell", "large capacity", "protozoa", "separation"] Word3 = ["bus", "virus", "compiler", "computer virus", "computer virus", "mobile", "mass production tool", "petri dish", "shape"]; word4 = ["Control Panel", "Actuator", "Log", "Controller", "Panel", "user", "Storage", "Administrator", "Domain", "ruler", "counter"] While True: number = 0 numbersc = input ("Please enter the number of technical terms to be generated:") numbersc = int (scnumber) while number < numbersc: N1 = random.randint (0L9) N2 = random.randint (0L9) n3 = random.randint (0L8) N4 = random.randint (0L10) number2 = number + 1 number2 = str (number2) print ("you The generated technical term "+ number2 +" is:\ n "+ word1 [N1] + word2 [N2] + word3 [N2] + word4 [N4] +"\ n ") number + = 1
Take the code and show off in front of your family and friends.
Here, a run result is given (the result of each run is different! ):
Please enter the number of technical terms to be generated: 5 the first technical term you generate is: general-purpose cellular computer virus controller the second professional term you generate is: balanced protozoa movement domain the third professional term you generate is: 2Compact 7 separation bus operator the fourth professional term you generate is: balanced cell production tool ruler the fifth professional term you generate is: general For bulk compilation administrators, please enter the number of technical terms to be generated (:
Take the code and show off in front of your family and friends.
Here, a run result is given (the result of each run is different! ):
Please enter the number of technical terms to be generated: 5 the first technical term you generate is: general-purpose cellular computer virus controller the second professional term you generate is: balanced protozoa movement domain the third professional term you generate is: 2Compact 7 separation bus operator the fourth professional term you generate is: balanced cell production tool ruler the fifth professional term you generate is: general Please enter the number of technical terms to be generated by the mass compiler administrator: thank you for reading The above is the content of "how to use java and python to make a professional terminology learning machine". After the study of this article, I believe you have a deeper understanding of how to use java and python to make a professional terminology learning machine. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.