Create an account


Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 20,124
» Latest member: codestar101
» Forum threads: 21,771
» Forum posts: 22,640

Full Statistics

Online Users
There are currently 944 online users.
» 1 Member(s) | 939 Guest(s)
Applebot, Baidu, Bing, Google, codestar101

 
  (Indie Deal) Blood Bowl 3 Raffle & Whale Rock Sale
Posted by: xSicKxBot - 12-15-2022, 07:36 AM - Forum: Deals or Specials - No Replies

Blood Bowl 3 Raffle & Whale Rock Sale

Blood Bowl III Pre-Order Raffle
[www.indiegala.com]
Pre-purchase for early bonuses from the IG store[www.indiegala.com]
https://www.youtube.com/watch?v=t3bWhhsbeXA
Pre-Purchase Blood Bowl 3 - Black Orcs Edition[www.indiegala.com]
Pre-Purchase Blood Bowl 3 Brutal Edition (48 hours early unlock)[www.indiegala.com]
Pre-Purchase Blood Bowl 3 - Imperial Nobility Edition[www.indiegala.com]

Whale Rock Games Sale, up to 93% OFF
[www.indiegala.com]

https://www.youtube.com/watch?v=zQLYCsWx0uQ
[discord.gg]


https://steamcommunity.com/groups/indieg...0232171956

Print this item

  (Free Game Key) Behold the Kickmen - Free Steam Game
Posted by: xSicKxBot - 12-15-2022, 07:36 AM - Forum: Deals or Specials - No Replies

Behold the Kickmen - Free Steam Game

Behold the Kickmen - Free Steam Game

- Go to the giveaway page
- https://fanatical.com/game/behold-the-kickmen?ref=gfg
- Add to cart (to add the game to cart)
- Proceed to Checkout button on the right
- View order
- Reveal key button (a suggestion is to reveal it and use it as soon as possible)

Please note sometimes the key is region locked, and it may require a steam acc that is not limited)

(it says that key expires on 14th jan. but im not sure if its the revealed key or the actual key, the game on your account will remain if you activate it before then)

We are welcoming everyone to join our discord[discord.gg]. We are more active there on finding giveaways, small or large, and there are daily raffles you can participate.

?GrabFreeGames.com ?Twitter ?Steam Curator ?Facebook[fb.me]?Discord[discord.gg]
❤️Support us: HumbleBundle Partner[www.humblebundle.com] Fanatical Affiliate[www.fanatical.com]


https://steamcommunity.com/groups/GrabFr...2002137713

Print this item

  PC - The Knight Witch
Posted by: xSicKxBot - 12-15-2022, 07:36 AM - Forum: New Game Releases - No Replies

The Knight Witch



The Knight Witch is a metroidvania adventure game with fast-paced, shoot 'em up combat set in a beautifully hand-drawn world.

Cast devastating card-based spells, forge close bonds, and make moral choices all in your quest to save your home and discover who's behind the War Golem invasion.

Publisher: Team17

Release Date: Nov 29, 2022




https://www.metacritic.com/game/pc/the-knight-witch

Print this item

  [Oracle Blog] Java Client Roadmap Updates
Posted by: xSicKxBot - 12-14-2022, 01:24 PM - Forum: Java Language, JVM, and the JRE - No Replies

Java Client Roadmap Updates

Oracle has published an update to the Java Client Roadmap which extends availability and support timelines for many Java Client related technologies. Executive Summary: Oracle has extended commercial support and updates for Java SE 8 from March 2025 to at least December 2030. Oracle has extended ind...


https://blogs.oracle.com/java/post/java-...ap-updates

Print this item

  [Tut] Python | Split Text into Sentences
Posted by: xSicKxBot - 12-14-2022, 01:24 PM - Forum: Python - No Replies

Python | Split Text into Sentences

Rate this post

✨Summary: There are four different ways to split a text into sentences:
? Using nltk module
? Using re.split()
? Using re.findall()
? Using replace

Minimal Example


text = "God is Great! I won a lottery." # Method 1
from nltk.tokenize import sent_tokenize
print(sent_tokenize(text)) # Method 2
import re
res = [x for x in re.split("[//.|//!|//?]", text) if x!=""]
print(res) # Method 3
res = re.findall(r"[^.!?]+", text)
print(res) # Method 4
def splitter(txt, delim): for i in txt: if i in delim: txt = txt.replace(i, ',') res = txt.split(',') res.pop() return res sep = ['.', '!']
print(splitter(text, sep)) # Output: ['God is Great', ' I won a lottery']

Problem Formulation


Problem: Given a string/text containing numerous sentences; How will you split the string into sentences?

Example: Let’s visualize the problem with the help of an example.

# Input
text = "This is sentence 1. This is sentence 2! This is sentence 3?"
# output
['This is sentence 1', ' This is sentence 2', ' This is sentence 3']

Method 1: Using nltk.tokenize


Natural Language Processing (NLP) has a process known as tokenization using which a large quantity of text can be divided into smaller parts called tokens. The Natural Language toolkit contains a very important module known as NLTK tokenize sentence which further comprises sub-modules. We can use this module and split a given text into sentences.

Code:

from nltk.tokenize import sent_tokenize
text = "This is sentence 1. This is sentence 2! This is sentence 3?"
print(sent_tokenize(text)) # ['This is sentence 1.', ' This is sentence 2!', ' This is sentence 3?']

Explanation: 

  • Import the sent_tokenize module.
  • Further, the sentence_tokenizer module allows you to parse the given sentences and break them into individual sentences at the occurrence of punctuations like periods, exclamation,  question marks, etc.

Caution: You might get an error after installing the nltk package. So, here’s the entire process to install nltk in your system.

Install nltk using → pip install nltk

Then go ahead and type the following in your Python shell:

import nltk
nltk.download('punkt')

That’s it! You are now ready to use the sentence_tokenizer module in your code.

Method 2: Using re.split


The re.split(pattern, string) method matches all occurrences of the pattern in the string and divides the string along the matches resulting in a list of strings between the matches. For example, re.split('a', 'bbabbbab') results in the list of strings ['bb', 'bbb', 'b'].

Approach: Split the given string using alphanumeric separators, and use the either-or (|) metacharacter. It allows you to specify each separator within the expression like so: re.split("[//.|//!|//?]", text). Thus, whenever the script encounters any of the mentioned characters specified within the pattern, it will split the given string. The expression x!="" ignores all the empty characters.

Code:

import re
text = "This is sentence 1. This is sentence 2! This is sentence 3?"
res = [x for x in re.split("[//.|//!|//?]", text) if x!=""]
print(res) # ['This is sentence 1', ' This is sentence 2', ' This is sentence 3']

?Recommended Read:  Python Regex Split

Method 3: Using findall


The re.findall(pattern, string) method scans the string from left to right, searching for all non-overlapping matches of the pattern. It returns a list of strings in the matching order when scanning the string from left to right.

Code:

import re
text = "This is sentence 1. This is sentence 2! This is sentence 3?"
res = re.findall(r"[^.!?]+", text)
print(res) # ['This is sentence 1', ' This is sentence 2', ' This is sentence 3']

Explanation: In the expression, i.e., re.findall(r"[^.!?]+", text), all occurrences of characters are grouped except the punctuation marks. []+ denotes that all occurrences of one or more characters except (given by ^) ‘!’, ‘?’, and ‘.’ will be returned. Thus, whenever the script finds and groups all characters until any of the mentioned characters within the square brackets are found. As soon as one of the mentioned characters is found it splits the string and finds the next group of characters.

?Related Read: Python re.findall() – Everything You Need to Know

Method 4: Using replace


Approach: The idea here is to replace all the punctuation marks (‘!’, ‘?’, and ‘.’) present in the given string with a comma (,) and then split the modified string to get the list of split substrings. The problem here is the last element returned will be an empty string. You can use the pop() method to remove the last element out of the list of substrings (the empty string).

Code:

def splitter(txt, delim): for i in txt: if i in delim: txt = txt.replace(i, ',') res = txt.split(',') res.pop() return res sep = ['.', '!', '?']
text = "This is sentence 1. This is sentence 2! This is sentence 3?"
print(splitter(text, sep)) # ['This is sentence 1', ' This is sentence 2', ' This is sentence 3']

?Related Read: Python String replace()

Conclusion


We have successfully solved the given problem using different approaches. I hope this article helped you in your Python coding journey. Please subscribe and stay tuned for more interesting articles.

Happy coding! ?


Do you want to master the regex superpower? Check out my new book The Smartest Way to Learn Regular Expressions in Python with the innovative 3-step approach for active learning: (1) study a book chapter, (2) solve a code puzzle, and (3) watch an educational chapter video.



https://www.sickgaming.net/blog/2022/12/...sentences/

Print this item

  (Indie Deal) Monster Spark Bundle & Black Friday are officially here
Posted by: xSicKxBot - 12-14-2022, 01:24 PM - Forum: Deals or Specials - No Replies

Monster Spark Bundle & Black Friday are officially here

Monster Spark Bundle | 6 Steam Games | 95% OFF
[www.indiegala.com]
All you need is that one spark to unleash the monster in you, one that will enjoy a video game experience like never before: DwarfHeim, RIOT: Civil Unrest, The Long Reach, Sparklite, Mainlining Deluxe Edition, Monster Harvest.

Black Friday is here...officially!
[www.indiegala.com]
Extra 10% cashback as a BONUS in this period only!
https://www.youtube.com/watch?v=5B3fuoNaoj4
Tales of Giveaways
[www.indiegala.com]


https://steamcommunity.com/groups/indieg...9740505321

Print this item

  (Free Game Key) 4 Steam Freebies (DLCs and +1 Games)
Posted by: xSicKxBot - 12-14-2022, 01:24 PM - Forum: Deals or Specials - No Replies

4 Steam Freebies (DLCs and +1 Games)

Divine Knockout DKO
(for some reason this game says its a free 2 play game, but it costs money)
Activating the game this way will add +1 to your account, just click Install
Store Page

Capcom Arcade Stadium:FINAL FIGHT
This is a dlc for Capcom Arcade (f2p)
First activate
Capcom Arcade
Then Activate the DLC Final Fight

World of Warships New Year Camo
World of Warship - activate the base game first
New Year Camo Collection

World of Tanks Holiday Gift Pack
World of Tanks - activate the base game first
Holiday Gift Pack

We are welcoming everyone to join our discord[discord.gg]. We are more active there on finding giveaways, small or large, and there are daily raffles you can participate.

?GrabFreeGames.com ?Twitter ?Steam Curator ?Facebook[fb.me]?Discord[discord.gg]
❤️Support us: HumbleBundle Partner[www.humblebundle.com] Fanatical Affiliate[www.fanatical.com]


https://steamcommunity.com/groups/GrabFr...3044991668

Print this item

  PC - World of Warcraft: Dragonflight
Posted by: xSicKxBot - 12-14-2022, 01:24 PM - Forum: New Game Releases - No Replies

World of Warcraft: Dragonflight



The dragonflights of Azeroth have returned, called upon to defend their ancestral home, the Dragon Isles. Surging with elemental magic and the life energies of Azeroth, the Isles are awakening once more, and it's up to you to explore their primordial wonder and discover long-forgotten secrets.

Publisher: Activision

Release Date: Nov 28, 2022




https://www.metacritic.com/game/pc/world...agonflight

Print this item

  [Oracle Blog] Our World. Moved by Java.
Posted by: xSicKxBot - 12-13-2022, 06:04 AM - Forum: Java Language, JVM, and the JRE - No Replies

Our World. Moved by Java.

Authored by: Georges Saab (VP, Java Platform Group and Chair, OpenJDK Governing Board) It is hard to believe that it has been 25 years since Java became officially available. On the other hand, it seems like several eras have passed - and in some sense, they have. I still remember the sense of excit...


https://blogs.oracle.com/java/post/our-w...ed-by-java

Print this item

  [Tut] Python | Split String with Regex
Posted by: xSicKxBot - 12-13-2022, 06:04 AM - Forum: Python - No Replies

Python | Split String with Regex

Rate this post

Summary: The different methods to split a string using regex are:

  • re.split()
  • re.sub()
  • re.findall()
  • re.compile()

Minimal Example


import re text = "Earth:Moon::Mars:Phobos" # Method 1
res = re.split("[:]+", text)
print(res) # Method 2
res = re.sub(r':', " ", text).split()
print(res) # Method 3
res = re.findall("[^:\s]+", text)
print(res) # Method 4
pattern = re.compile("[^:\s]+").findall
print(pattern(text)) # Output
['Earth', 'Moon', 'Mars', 'Phobos']

Problem Formulation


?Problem: Given a string and a delimiter. How will you split the string using the given delimiter using different functions from the regular expressions library?

Example: In the following example, the given string has to be split using a hyphen as the delimiter.

# Input
text = "abc-lmn-xyz" # Expected Output
['abc', 'lmn', 'xyz']

Method 1: re.split


The re.split(pattern, string) method matches all occurrences of the pattern in the string and divides the string along the matches resulting in a list of strings between the matches. For example, re.split('a', 'bbabbbab') results in the list of strings ['bb', 'bbb', 'b'].


Approach: Use the re.split function and pass [_]+ as the pattern which splits the given string on occurrence of an underscore.

Code:

import re text = "abc_lmn_xyz"
res = re.split("[_]+", text)
print(res) # ['abc', 'lmn', 'xyz']

?Related Read: Python Regex Split

Method 2: re.sub


The regex function re.sub(P, R, S) replaces all occurrences of the pattern P with the replacement R in string S. It returns a new string. For example, if you call re.sub('a', 'b', 'aabb'), the result will be the new string 'bbbb' with all characters 'a' replaced by 'b'.


Approach: The idea here is to use the re.sub function to replace all occurrences of underscores with a space and then use the split function to split the string at spaces.

Code:

import re text = "abc_lmn_xyz"
res = re.sub(r'_', " ", text).split()
print(res) # ['abc', 'lmn', 'xyz']

?Related Read: Python Regex Sub

Method 3: re.findall


The re.findall(pattern, string) method scans string from left to right, searching for all non-overlapping matches of the pattern. It returns a list of strings in the matching order when scanning the string from left to right.


Approach: Find all occurrences of characters that are separated by underscores using the re.findall().

Code:

import re text = "abc_lmn_xyz"
res = re.findall("[^_\s]+", text)
print(res) # ['abc', 'lmn', 'xyz']

?Related Read: Python re.findall()

Method 4: re.compile


The method re.compile(pattern) returns a regular expression object from the pattern that provides basic regex methods such as pattern.search(string)pattern.match(string), and pattern.findall(string). The explicit two-step approach of (1) compiling and (2) searching the pattern is more efficient than calling, say, search(pattern, string) at once, if you match the same pattern multiple times because it avoids redundant compilations of the same pattern.


Code:

import re text = "abc_lmn_xyz"
pattern = re.compile("[^-\s]+").findall
print(pattern(text)) # ['abc', 'lmn', 'xyz']

Why use re.compile?


  • Efficiency: Using re.compile() to assemble regular expressions is effective when the expression has to be used more than once. Thus, by using the classes/objects created by compile function, we can search for instances that we need within different strings without having to rewirte the expressions again and again. This increases productivity as well as saves time.
  • Readability: Another advantage of using re.compile is the readability factor as it leverages you the power to decouple the specification of the regex.

?Read: Is It Worth Using Python’s re.compile()?

Exercise


Problem: Python regex split by spaces, commas, and periods, but not in cases like 1,000 or 1.50.

Given:
my_string = "one two 3.4 5,6 seven.eight nine,ten"
Expected Output:
["one", "two", "3.4", "25.6" , "seven", "eight", "nine", "ten"]

Solution

my_string = "one two 3.4 25.6 seven.eight nine,ten"
res = re.split('\s|(?<!\d)[,.](?!\d)', my_string)
print(res) # ['one', 'two', '3.4', '25.6', 'seven', 'eight', 'nine', 'ten']

Conclusion


Therefore, we have learned four different ways of splitting a string using the regular expressions package in Python. Feel free to use the suitable technique that fits your needs. The idea of this tutorial was to get you acquainted with the numerous ways of using regex to split a string and I hope it helped you.

Please stay tuned and subscribe for more interesting discussions and tutorials in the future. Happy coding! ?


Do you want to master the regex superpower? Check out my new book The Smartest Way to Learn Regular Expressions in Python with the innovative 3-step approach for active learning: (1) study a book chapter, (2) solve a code puzzle, and (3) watch an educational chapter video.



https://www.sickgaming.net/blog/2022/12/...ith-regex/

Print this item

 
Latest Threads
[Verified] 30% Off Temu C...
Last Post: codestar101
Less than 1 minute ago
Temu Coupon Code 30% OFF ...
Last Post: codestar101
1 minute ago
How To Get Temu Coupon Co...
Last Post: codestar101
3 minutes ago
Temu Coupon Code 30% Off ...
Last Post: codestar101
4 minutes ago
New Temu Coupon Code [ald...
Last Post: codestar101
6 minutes ago
Temu Coupon Code 30% Off ...
Last Post: codestar101
7 minutes ago
Temu Coupon 30%Off Code [...
Last Post: codestar101
9 minutes ago
Cupones Para Temu [ald911...
Last Post: Bebeckman6
15 minutes ago
Codice Coupon Temu Primo ...
Last Post: Bebeckman6
16 minutes ago
Cupon De Temu [ald911505]...
Last Post: Bebeckman6
17 minutes ago

Forum software by © MyBB Theme © iAndrew 2016