Open funderburkjim opened 2 years ago
Of course, questions and comments here welcome.
questions and comments here welcome.
Guess it will take her a few more days to recover. I myself was dead for three days, but now it's ower. She will soon follow.
Were you and Anna taken by Covid? Glad you are better, and hope also Anna recovers soon.
It was not covid for me, hope not for Anna as well. Anna said she'll be back in a couple of days. And I would want to introduce Kate, @KateRusse from the same city Anna initially came from, from the same Saint Petersburg State University.
Were you and Anna taken by Covid
Dear all, Finally I came back! I suppose I had a virus, I did two rapid test for Covid, both of them were negative, but we know many cases of incorrect work of such simple tests. In any case I am almost fine and from today I again have more or less normal life.
Of course, questions and comments here welcome.
Dear Jim, Of course, I have some questions)))
I have managed to open the file readwrite.py only by IDLE (there was option "Edit with IDLE". Is it ok? It looks like this:
In general I understood the structure and the described functions.
Could you provide more details how to run the program, I mean: Usage: python readwrite.py ../data.txt readwrite.txt
the same city Anna initially came from, from the same Saint Petersburg State University
Marcis, you aren't quite right, before Greece I was living and studying in Moscow. In Saint Petersburg and in Saint Petersburg State University I just have a lot of friends.
open the file readwrite.py only by IDLE
I suggest NOT to do this. Although IDLE is part of the Python download, I never use it.
I suggest opening readwrite.py with your favorite text editor. The way I do this on Windows 10 is:
The first time you do this, your editor may not show up in the list. In this case select 'Choose another app'.
If your editor doesn't show in the 'choose another app' list, then click on 'more apps' You'll get a bigger list, where your editor should appear. Then select it. You could experiment with selecting the 'Always use this to open .py' Personally I don't use it, even though I do always open .py files with Emacs.
Note: It's possible your editor won't appear in the longer 'choose another app' list. Then you would need to click 'Look for another app on this PC', which will open a standard File Explorer dialog which you would use to navigate to the 'exe' file that opens your editor.
python readwrite.py ../data.txt readwrite.txt
This is the 'command' to use in a terminal, such as the git bash terminal. So type (or copy-paste) this command into the terminal, then press 'enter' so the terminal program will execute the command.
Dear Jim, many thanks!!! I suppose i understood now what to do. I will try to manage it tomorrow.
You may see the term 'development environment' which refers to the programs (tools) used to aid in the development of programs written in some programming language. In the way I am describing to you, the development environment involves three components:
This is a minimalist python development environment. Professional programmers would likely use something else, such as
What we are doing might be classified as a type of natural language processing, which is considered a branch of 'data science',
Effective use of these more robust development environments requires gaining knowledge of the tools and, sometimes, a complex installation procedure. For me, the learning curve has never been worth it. But I do occasionally like to experiment with Jupyter notebooks. When beginning Python programming several years ago, I also made use of some simpler web-based programming environments such as
And probably others.
Depending on how your interest in Python develops, you may sometime want to try some of these other approaches. But for now, I'll stick with helping you learn via the 'minimalist' environment.
I suggest opening readwrite.py with your favorite text editor.
Dear Jim, This step has done
This is the 'command' to use in a terminal, such as the git bash terminal.
but I have some difficulties with this:
Maybe do you see what I do wrong?
The default one for students.
@AnnaRybakovaT The command to execute the program must be consistent with where things are in the file system. Notice that you are in the directory 'MD'. But that is not where 'readwrite.py' is found. (do you see how the error message gives this clue?)
Thus, you need to find the directory containing this 'readwrite.py' program, then 'cd' there in Gitbash. So, what directory is readwrite.py in ? Do an 'ls' to list all the files in that directory. Then redo the command. Finally, do an 'ls' again to see if there are any new files in the directory. If there is a new file, edit it in EMeditor and see how the new file and original file (what is the 'original' file in this case?) Then review readwrite.py to understand how the original file was changed into the new file.
Notice that you are in the directory 'MD'. But that is not where 'readwrite.py' is found
Dear Jim, Thanks a lot! I was close))) Now I did it!
I will continue tomorrow. And now it's bedtime.
Yep! You got it!
Do you understand why the command has '../data.txt' instead of 'data.txt' ? What is that '../' ? What happens if you omit the '../' ?
What happens if you run the command
python readwrite.py ../data.txt ../temp_readwrite.txt
?
And why did I write '../temp_readwrite.txt' instead of '../readwrite.txt' ?
Dear Jim, Step 0 has done. Only I can't push the directory
@AnnaRybakovaT Try now
Do you understand why the command has '../data.txt' instead of 'data.txt' ? What is that '../' ? What happens if you omit the '../' ?
To be honest I can only guess. For example - when we work with the file 'data.txt' by Python this program creates one new file '../data.txt' which includes some data of 'data.txt'. I noticed - such files aren't tracked by "git add"
In any case, I suppose I need your support and explanations about this issue.
Try now
Thanks! It works now!
I pulled, and now see your results of running readwrite program and that you made a new version 'readwriteA1.py', ran the program and generated 'readwriteA1.txt' . I see that you discovered to use 'lower' method instead of 'upper'. That's what I expected. A good start!
Some suggestions regarding 'documentation' of your new program. The main principle: add enough documentation to help recall what you did.
Documentation is never perfect, and what is enough documentation is subjective.
Here are suggestions regarding documentation of readwriteA1.
Some suggestions regarding 'documentation' of your new program. The main principle: add enough documentation to help recall what you did.
Is "documentation" should be in a file "readme"?
Dear all, Just for information. Tomorrow I am going to Athens for some days, so until Saturday I will unavailable.
Is "documentation" should be in a file "readme"?
First, there is already a file 'readme.txt' in step0 directory, which I started. The documentation suggestion above involved both readme.txt and readwriteA1.py.
I presume that
md/deva_iast_comp/step0
git add .
command in git bash terminalIn this case, git picks up all the modified files in the current directory or in any subdirectories of the current directory. So git shows the two readwriteA1 files in green, indicating it found them.
But it didn't pick up md/deva_iast_comp/readwrite.txt
-- that's why '../readwrite.txt' shows in red and is said to be untracked.
When current directory is md/deva_iast_comp/step0
, then '../' refers to the parent directory,
i.e., to the directory md/deva_iast_comp
.
In terminal, make step0 your current dirrectory, then issue command ls ../
--- you should see a listing of all the files in the parent directory. Use File explorer if necessary to convince yourself that the list is indeed the files in parent directory.
Next try ls ../../
--- Before doing make a guess as to what you will see.
I think you really don't want md/deva_iast_comp/readwrite.txt. (the readwrite.txt you want is md/deva_iast_comp/readwrite.txt, which you've already pushed). So just delete it. Then do a 'git status' to be sure git no longer sees it.
This was in running readwrite.py (and similarly your readwriteA1.py).
I put data.txt in the deva_iast_comp directory on purpose, in anticipation of using it as the input file not only in step0 but in future step1, step2, etc.
But since we are running our program from step0 (and later from step1, etc.),
python readwrite.py data.txt temp.txt
would not find data.txt (since data.txt is not in step0).
You can try running this command (with data.txt instead of ../data.txt) to see what happens; You will get an error condition saying the program did not find 'data.txt'.
Thus, we have to indicate the full location of data.txt, and since data.txt is in the directory which
is a parent of step0 directory, we use '../data.txt' in the command to indicate the path to the
input file relative to where the program is being run:
python readwrite.py ../data.txt readwrite.txt
.
Here's an analogy that may be helpful in thinking about '../' and other things about locations.
Think of the 'MD' directory as a multi-level house, with each level containing rooms, and possibly containing stairs connecting the levels. The top level currently contains a room with only README.md sitting on the floor, along with two stairs going down one level to rooms deva_iast_comp and verbs01.
jimfu@DESKTOP-6PTUC6R MINGW64 /c/xampp/htdocs/sanskrit-lexicon/md (master)
$ ls
README.md deva_iast_comp/ verbs01/
We can use the stairs down to deva_iast_comp room:
jimfu@DESKTOP-6PTUC6R MINGW64 /c/xampp/htdocs/sanskrit-lexicon/md (master)
$ cd deva_iast_comp
jimfu@DESKTOP-6PTUC6R MINGW64 /c/xampp/htdocs/sanskrit-lexicon/md/deva_iast_comp (master)
What's in that room?
jimfu@DESKTOP-6PTUC6R MINGW64 /c/xampp/htdocs/sanskrit-lexicon/md/deva_iast_comp (master)
$ ls
data.txt readme.txt step0/
two boxes data.txt and readme.txt, and a stairway down to a room step0.
If we want to go back up to the level above this level, the stairway up is known as '../'
jimfu@DESKTOP-6PTUC6R MINGW64 /c/xampp/htdocs/sanskrit-lexicon/md/deva_iast_comp (master)
$ cd ../
jimfu@DESKTOP-6PTUC6R MINGW64 /c/xampp/htdocs/sanskrit-lexicon/md (master)
Don't know if this analogy is helpful. If not, just ignore.
Don't know if this analogy is helpful. If not, just ignore.
Dear Jim, Thanks a lot! Everything is absolutely clear now!!!
You will get an error condition saying the program did not find 'data.txt'.
I had this message during my 1st try to write the Usage for readwriteA1.py. And now I understood why))
both readme.txt and readwriteA1.py.
Has done.
md/deva_iast_comp/readwrite.txt. (the readwrite.txt you want is md/deva_iast_comp/readwrite.txt
I am confused a bit... Probably I have to delete one of those files: md/deva_iast_comp/step0/readwrite.txt or md/deva_iast_comp/readwrite.txt
You could delete md/deva_iast_comp/readwrite.txt (you would also need to change your documentation deva_iast_comp/step0/readme.txt at line 44 from '../readwrite.txt' to '../data.txt'.
I'll start preparing a 'step1' . Where we'll do more complex things in the 'adjustlines' function.
you would also need to change your documentation deva_iast_comp/step0/readme.txt at line 44 from '../readwrite.txt' to '../data.txt'.
Dear Jim, In this case the documentation and at line 41 has to be changed: "readwriteA1.py Second python program, designed to read the lines of data.txt" (instead of "....to read the lines of readwrite.txt) Is it correct?
Yes, exactly.
Incidentally, the suggested change to documentation is optional. But, in the hypothetical case where you
Then someone reading the documentation in readme and trying the suggested command would get an error, and thus might be confused. It is to avoid (to the extent possible) such confusion that I suggested the change to the readme file. It's good to get in the habit of thinking of documentation as an integral part of programming.
It's good to get in the habit of thinking of documentation as an integral part of programming.
It is something to be learnt from you. Actually I have quite many Russian newcommers and they are ready for different tasks. What could we test them on?
@gasyoun What kinds of 'different tasks' are you thinking of for the newcomers? Programmatic analysis of data related to Sanskrit?
Yes, exactly.
Thanks!!! Just wanted to be sure. Now has done.
What kinds of 'different tasks' are you thinking of for the newcomers?
Whatever - checking of lists of suspected words, abbreviation cleanup, literally anything.
Programmatic analysis of data related to Sanskrit?
They are no-coders, or maybe one them is a bit, but I would not push in this directin too far.
@gasyoun got it. Will keep this in mind and develop some ideas.
@AnnaRybakovaT - Please git pull (or clone) this https://github.com/sanskrit-lexicon/MD/ repository and Check out the 'deva_iast_comp' directory, starting with the readme files.
Then try the suggestions for study in step0/readme.txt.
When you're ready, push the directory again.