There is a big data file whose format is:
111111 11 22 33 44 55 66 77
222222 21 22 23 29 99 98 00
...... ..
then how can i use prolog to calculate each number’s frequency ?
Sincerely!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You have two problems: Parsing the file and calculating the frequencies.
For parsing the file, I recommend using
library(pio). In that manner you can use dcgs to process the file. So, I’d recommend you learn first about DCGs. They are Prolog’s way to describe/generate and parse text. They are even more general than that. But to start with, just see it that way.This you can then combine with calculating the frequencies. To make this also efficient for very large data see this question.