Text_Preprocessing_Removing_Punctuation - data-preprocessing

#Remove Punctuations
data['Review'] = data['Review'].str.replace('[^A-Za-z0-9]+',"",regex=True)
print (data)
I'm trying to Remove Punctuation from text. But the above mentioned code function removing punctuations with space between two words. i need the sentences with space.
Input
Review
0 Our aim was to see the elephants for the child...
1 A great place to see many elephants at one pla...
2 I first visited Pinnawala 20 years ago and I ...
3 A bit of a mixed review. I do agree with lots ...
4 We thought wed go to a nice elephant orphanag...
Output
Review
0 ouraimwastoseetheelephantsforthechildrenandwal...
1 agreatplacetoseemanyelephantsatoneplacetheyloo...
2 ifirstvisitedpinnawala20yearsagoandiwasenthral...
3 abitofamixedreviewidoagreewithlotsofthereviews...
4 wethoughtwedgotoaniceelephantorphanagewherethe...
Please help me to solve this issue

Related

Special Acronym Finder

I'm compiling an acronyms/abbreviations table for a document. Beyond a simple acronym finder, I would like to find special acronyms that aren't entirely conventional.
Generally I can find acronyms by using <[A-Z]{2,}> in an advanced search. This captures any whole word that is comprised solely of uppercase letters. But I have acronyms that take on other forms too. Beyond an acronym being in the form ABC I have acronyms in this document of other forms.
ABC Generic form, 2 or more uppercase letters
AB&C 1 or more letters preceding and following &
ABC(D) 1 letter in parentheses following 2 or more letters (this only appears twice, so I'm not too worried about it.)
A/C 1 or more letters both preceding and following /
ABC-12 2 or more letters followed by a hyphen and 1 or 2 numbers. This only appears once, so I'm not really worried about it.
In my efforts to create an acronym finder, I've developed this specialized search.
<[A-Z]{1,}[\&\/]*[A-Z]{1,}>
Trying to translate this, I see that this is searching for 1 or more uppercase letters preceding 0 or more of & or / followed by 1 or more uppercase letters. In theory this should find forms 1,2, and 4, but in reality it only finds forms 2 and 4, and not 1. (I'm not as much worried about form 3 as I am form 1, 2, and 4.) I'm stumped at what I need to change. I've tried doing an OR | statement to find one or more form, but Microsoft Word's 'regex' options are different (or appear to be different) from what I generally use.
In summary, my question is what form should my special acronym finder be to find forms 1, 2, and 4 in the table above?
You can use a wildcard Find, where:
Find = <[A-Z][A-Z0-9&()/-]{1,}
Beyond that, for identifying acronyms in parentheses and the text to which they refer, see: https://www.msofficeforums.com/word-vba/42313-acronym-definiton-list-generator.html
See also: https://www.msofficeforums.com/word-vba/19395-acronym-finder-macro-microsoft-word.html

Is there a DevExpress DateEdit mode where users can type numbers without slash delimiter

Users who are used to working with another software package would like to type just the numbers of dates, without slashes: 0 9 1 8 2 0 1 7. They have developed "muscle-memory" for dates and are pretty grumpy about having to enter the slashes.
This is a "heads down" data-entry scenario where they have to enter hundreds of dates, and speed is a concern. They say that they often have to enter dates from previous years, and it takes too long to navigate to the past years using the dropdown calendar.
Is there a mode setting for the DevExpress DateEdit for Winforms which allows that mode of entry?
Try to specify a mask, I think it should work.
Set mask property, as you need.. but you must be clear what type of date format user will enter

CNTK: Start of features is set to 1 - mechanism of UCIFastReader

sorry for this rather simple question, however there is yet too little documentation about the usage of Microsoft's OpenSource AI library CNTK.
I continue to witness people setting the reader's feature start to 1, while setting the labels start to 0. But should both of them be always 0, as informations does in computer science always start from the zero point? Wouldn't we lose one piece of information this way?
Example of CIFAR10 02_BatchNormConv
features=[
#dimension = 3 (rgb) * 32 (width) * 32(length)
dim=3072
start=1
]
labels=[
dim=1
start=0
labelDim=10
labelMappingFile=$DataDir$/labelsmap.txt
]
Update: New format
Microsoft has recently updated this, in order to get rid of these confusion and make the CNTK Definition Language more readable.
Instead of having to define the start of the values within the line, you can now simply define the type of data in the dataset itself:
|labels <tab seperated values> | features <tab seperated values> [EndOfLine/EOL]
if you want to reverse the order of features and lables you can simply go for:
|features <tab seperated values> | labels <tab seperated values> [EndOfLine/EOL]
You only have still to define the dim value, in order to specify the amount of values you want to input.
Note: There's no | at the end of the row. EOL indicates the end of the row.
For more information visit the CNTK Wiki on this topic.
You are misunderstanding how the reader works. The UCIFastReader works on a file which contains tab separated feature vector. Each line in this file corresponds to an entry (an image in this case), as well as its classification.
So, dim tells the reader how many columns to read, while start tells the reader from which column to start reading.
So, if you had an image of size 2x2, with a 2 labels for each, your file could be of the form <image_pixel_columns><label_columns>:
0 0 0 0 0 0
0 0 1 0 1 0
...
So the first 4 entries in the line are your features (image pixel values), and the last two are your labels. Your reader would be of the form:
reader=[
readerType=UCIFastReader
file=$DataDir$/Train.txt
randomize=None
features=[
dim=4
start=0
]
labels=[
dim=2
start=4
labelDim=10
labelMappingFile=$DataDir$/labelsmap.txt
]
]
It's just that all examples given have the label placed in the first column.

How to obtain ISBN Barcode in iOS

I am doing a project on ISBN barcode scanning. I have tried many scanning applications but after scanning this barcode:
the app only gives me back the barcode 9780749423490.
But what I need to obtain is the ISBN code 0749423498 instead, as it is in the database of my library. Is there any method to get it?
Can anyone explain the difference between these two codes? Why is the barcode number and ISBN barcode number different? Is it the same for some books and different for some ? thanks!
It looks like the confusion is the difference between the "ISBN 10" and "ISBN 13" standards.
The ISBN Agency website FAQ says:
"Does the ISBN-13 have any meaning imbedded in the numbers?
The five parts of an ISBN are as follows:
1. The current ISBN-13 will be prefixed by "978"
2. Group or country identifier which identifies a national or geographic grouping of publishers
3. Publisher identifier which identifies a particular publisher within a group
4. Title identifier which identifies a particular title or edition of a title
5. Check digit is the single digit at the end of the ISBN which validates the ISBN"
So the 978 is clearly just filler. After that, the next 9 numbers are obviously the same in both numbers. The last digit in both numbers is a check digit, which is different in ISBN 10 and ISBN 13. See this Wikipedia article for details, but the two formulas are:
For ISBN 10 (the top one), the sum of all digits multiplied by mutlipliers 10-9-8-7-6-5-4-3-2-1 mod 11 should be 0:
0*10 + 7 *9 + 4*8 + 9*7 + 4*6 + 2*5 + 3*4 + 4*3 + 9*2 + 8*1 % 11 == 0
For ISBN 13 (the bottom one) the sum of the odd digits * 1 plus the sum of the even digits * 3 should be 0. This is including the leading 978. (this is similar to the UPC code as "user..." mentioned but a little different as noted in the Wikipedia article):
9*1 + 7*3 + 8*1 + 0*3 + 7*1 + 4*3 + 9*1 + 4*3 + 2*1 + 3*3 + 4*1 + 9*3 + 0*1 % 10 == 0
So you can get the ISBN 10 code (top) from the ISBN 13 (bottom) code as follows:
isbnBaseCode = <9780749423490 from the 4th to 12th characters>
isbn10CheckDigit = 11 - (isbnBaseCode[0]*10 + isbnBaseCode[1]*9 + ... + isbnBaseCode[8]*2) % 11
isbnCode10 = isbnBaseCode + isbn10CheckDigit
The long and short of your question is that they are in fact both ISBNs.
One is in the 10 digit format and the other is in the newer 13 digit format.
978 074942349 0
074942349 8
The 978 is a prefix and the last digit, on both, is a check digit .
The barcode on the item you are scanning only represents the 13 digit format.
According to http://www.isbn.org/standards/home/isbn/transition.asp
You can always convert from 13 digit ISBN starting with 978 to the 10 digit format
and provides a link to an online converter. It also discusses the 979 prefix.
I don't believe the 979 prefix is being used yet but its good to be aware that they may be used in future.
Having worked in the Library apps space, when searching a library catalog
item records will vary greatly in what information they contain.
Item records, specifically regarding ISBN, can contain the 10 digit ISBN, 13 digit ISBN, both, or none. So to find an item you might have to try both formats.
I believe that some systems, if your search type is set to ISBN, will actually check the submitted ISBN and search for both formats automatically.
Depending on what your trying to do.
Many library search functions allow for wild cards which may make it easier to find
the item your looking for. For example:
'if the isbn has a length of 13 and starts with 978
remove the first 3 (the 978) and last digit (the check digit)
add a wildcard character to the front and back
begin search
end if
eg 9780749423490 would become *07494234*
The downside is that it might return multiple results.
Even if that were to happen it would likely only be a couple items and the one your
looking, if there, would be easy to spot.
As provided by others the Wikipedia article on ISBN goes into more technical details on how to convert between the 10 and 13 digit formats.
http://en.wikipedia.org/wiki/International_Standard_Book_Number
The number starting 978 is a product code, specifically a UPC (Universal Product Code), that includes the ISBN but without the check digit at the end. Have a look at ISBN on wikipedia for code on generating the check digit and you'll be able to reconstruct the ISBN from the UPC.

Help: ZX81 'BASIC' Peek function [duplicate]

This question already has answers here:
Help: ZX81 BASIC "Peek" function
(3 answers)
Closed 8 years ago.
I need a way to find if the character ('<') has hit a wall (Black pixel Graphic)
-On a ZX81 game.
I'm been looking at another game... which uses code
if peek(peek 16398 +256*peek 16399) = code "blackpixel graphic" then ...
Which seems to work for them...
Is this correct code?
I'm not really knowledgable with addresses and getting memory and stuff.
Please help me...
-If you know a better way. Please answer :)
-Someone mentioned 'cursor position' what the hell is that on a ZX81?
Thanks,
PEEK(PEEK 16398+256*PEEK 16399) is an idiom meaning “get the character number at the current PRINT position”. This works because the two-byte word at 16398 is used by the ZX81 BASIC/ROM to store a pointer to the memory location in the screen data block corresponding to the PRINT position.
So to do collision detection, you'd first have to set:
PRINT AT X,Y;
co-ordinates to where the > is about to move, then read
LET C= PEEK(PEEK 16398+256*PEEK 16399)
then you can print the > on-screen (overwriting the previous character whose code is now in C) if you want to before doing the check:
IF C=128 THEN ...
(I'm guessing the character you want is the all-black character 128, █.)
Oh boy, do I feel old.
Wow does this go back. I haven't used a ZX81, but I did write some games on a TRS-80 way back in the day.
The inner part:
(peek 16398 +256*peek 16399)
is pretty much taking the value of two memory locations (8 bit) and creating a 16 bit
number from them, which is then used as the address of the outer peek; you might rewrite this as:
addrToCheck = (peek 16398 +256*peek 16399)
pixelValue = peek(addrToCheck)
if pixelValue = code "blackpixel graphic" then...
I'm guessing that the 'addrToCheck' value is actually the character position in the game, expressed as an address on the screen. So if the value is not a wall, then you would update the values in address 16398 and 16399 with a new character position (using a 'poke', no doubt).
Hope this helps